Download a solution from your Farm (SP2100)

Wanted to download a solution from my farm. So did it with PowerShell:


param([string]$folder)
write-host ""
write-host -f Green "Get Solutions from Farm - Stef van Hooijdonk - v1.0"
write-host ""
$snapin="Microsoft.SharePoint.PowerShell"
if (get-pssnapin $snapin -ea "silentlycontinue") {
  write-host -f Green "PSsnapin $snapin is loaded"
}
else {
  if (get-pssnapin $snapin -registered -ea "silentlycontinue") {
    write-host -f Green "PSsnapin $snapin is registered"
    Add-PSSnapin $snapin
    write-host -f Green "PSsnapin $snapin is loaded"
  }
  else {
  write-host -f Red "PSSnapin $snapin not found"
}
}
write-host ""
$folder = Join-Path -Path $folder \ -resolve
if ( Test-Path $folder ) {
  $farm = Get-SPFarm
  foreach($sol in $farm.Solutions){
    $solutionFileName = $folder +$sol.SolutionFile.Name
    $sol.SolutionFile.SaveAs($solutionFileName )
    Write-Host "- saved" $sol.SolutionFile.Name
  }
}
else {
  Write-Host -f Red "ERROR: Folder ""$folder"" does not exist"
}
write-host ""
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: