Friday, November 15, 2013

How To Export WSP SharePoint Solution from Solution Store with PowerShell

This is a simple script that can be usefull during migration of SharePoint from 2010 version to 2013 version if you are using ContentDB upgrade model.

This ps1 extract all wsp solution deployed to a SharePoint Farm to a specific folder on file system.

$destFolderName = "D:\Tmp\ExportedWSP"
foreach ($solution in Get-SPSolution)
{
    $id = $Solution.SolutionID
    $title = $Solution.Name
    $filename = $Solution.SolutionFile.Name

    try {
        $solution.SolutionFile.SaveAs("$destFolderName\$filename")
        Write-Host " – done" -foreground green
    }
    catch
    {
        Write-Host " – error : $_" -foreground red
    }
}

Run it on SharePoint Management Shell with Farm Admin permission.

No comments: