About Me

My photo
Muthupet, TamilNadu, India
SharePoint 2010

Wednesday, May 29, 2013

Exporting Solutions packages (WSP files) with PowerShell


$dirName = "c:\Exported Solutions"
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
    }
}

No comments:

Post a Comment