PowerShell export SharePoint Administration Center solution, powershell

Source: Internet
Author: User

PowerShell export SharePoint Administration Center solution, powershell
PowerShell export SharePoint Management Center solution someone in SharePoint QQ Group asked if they could download (export) the solution in the management center. Because clicking solution in the Management Center will go to another page-deployment, recovery or return. The deployed solutions are as follows:
If no deployment is available, it will look like this:
Similarly, STSADM has no command to download or export the solution. I found that using PowerShell statements can easily meet the above requirements. Only three lines of code are required. For example, to export mjb. sharepoint. googlemaps. wsp, use the following code:

$farm = Get-SPFarm$file = $farm.Solutions.Item("mjb.sharepoint.googlemaps.wsp").SolutionFile$file.SaveAs("E:\mjb.sharepoint.googlemaps.wsp")
Note that you must be a field administrator and have the permission to configure the database. Exporting a solution sometimes does not meet the requirements. I naturally think of how to export all solutions? Try the following code: 
(Get-SPFarm).Solutions | ForEach-Object{$var = "E:" + "\" + $_.Name; $_.SolutionFile.SaveAs($var)}
Here I save all the solutions to the edisk. Of course, you can choose the storage location.

What does SharePointps1 do? in C #, you can call powershell to manage sharepoint2010.

Powershell is a new generation of Microsoft scripts. It can be understood as an alternative to CMD. All new Microsoft software versions, including Hyper-v, Exchange, and 2008R2 AD, can be managed through Powershell, of course, Sharepoint works.
In addition, Powershell actually comes from C #. Many classes are directly changed by C #, or even C.
Therefore, your goals can be achieved.

PS1 is the suffix of A powershell script. You can double-click it or run powershell *. PS1 in CMD to run the script.
However, because of permission control, you must first execute the following command to use the script. Otherwise, an error is reported.
Set-ExecutionPolicy unrestricted

The following is a sample code for C # To call a Powershell script. It is found online.

/*

* C # sample code for calling PowerShell

*

* System. Management. Automantion. dll must be referenced.

*/

Using System;

Using System. Collections. Generic;

Using System. Collections. ObjectModel;

Using System. Management. Automation;

Using System. Management. Automation. Runspaces;

Using System. Text;

Namespace ConsoleApplication

{

Class Program

{

Static void Main (string [] args)

{

String result = RunScript ("get-process ");

Console. Write (result );

Console. Read ();

}

/// <Summary>

/// Run the script information and return the Script output

/// </Summary>

/// <Param name = "scriptText"> script to be run </param>

/// <Returns> output of the script </returns>

Private static string RunScript (string scriptText)

{

// Create Powershell runspace

Runspace runspace = RunspaceFactory. CreateRunspace ();

// Open it

Runspace. Open ();

// Create a pipeline and feed it the script text

Pipeline pipeline = runspac... the remaining full text>

Sharepoint Document Management

Version Management, check-in and check-out, and good coordination are unparalleled advantages
How did you join the user? For AD authentication, you can create users in the domain first. sharepoint will synchronize with the domain

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.