1 Ekim 2012 Pazartesi

Sharepoint 2010 Export all the solutions (wsp files)

Hi,

If you d like to get all the solutions (wsp files) from a sharepoint server and save them into a location, you just need the below code:

Open the Power Shell as Admin, type:


Add-PSSnapin Microsoft.SharePoint.PowerShell –erroraction SilentlyContinue 
## setup our output directory 
$dirName = "d:\exports\ExportedSolutions
Write-Host Exporting solutions to $dirName 
 foreach ($solution in Get-SPSolution) 
 { 
 $id = $Solution.SolutionID 
 $title = $Solution.Name 
 $filename = $Solution.SolutionFile.Name 
 Write-Host "Exporting ‘$title’ to …\$filename" -nonewline 
 try 
 $solution.SolutionFile.SaveAs("$dirName\$filename")
 Write-Host " – done" -foreground green 
 } 
 catch 
 {
 Write-Host " – error : $_" -foreground red 
 }
 }

You can change the output location as you want, it would save all the solutions.

Great time saver !

Cheers

PS: Sorry I forgot to give the source, but you can google it though.

Hiç yorum yok:

Yorum Gönder