Showing posts with label solutions backup. Show all posts
Showing posts with label solutions backup. Show all posts

Saturday, August 24, 2013

PowerShell Script to backup WSP from Central Admin's solution gallery


For a specific solution backup

$solution = Get-SPSolution $packageName -ErrorAction SilentlyContinue
# Get the File name from Solution file.
$filename = $solution.SolutionFile.Name

# script to get the location where the script is running -- folder location.
$BaseFolder = (Get-Location -PSProvider FileSystem).ProviderPath

# Save the file to Disk
$solution.SolutionFile.SaveAs("$BackupFolder\$filename")


To backup all the solutions from central admin' solution gallery

$BaseFolder = (Get-Location -PSProvider FileSystem).ProviderPath
$SPSolutions = get-spsolution
foreach($solution in $spsolutions)
{
$filename = $solution.SolutionFile.Name
$solution.SolutionFile.SaveAs("$BackupFolder\$filename")
}