Skip to content

Instantly share code, notes, and snippets.

@ciphertxt
Created March 26, 2013 11:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ciphertxt/5244814 to your computer and use it in GitHub Desktop.
Save ciphertxt/5244814 to your computer and use it in GitHub Desktop.
Saves all farm solutions to the specified directory
function Get-SPFarmSolutions {
    param (
        [string] $directory = $(Read-Host -prompt "Enter a directory (use ""."" for current dir)")
    )
 
    if ($directory.Length -lt 2) {
        $directory = [string]$pwd + "\\";
    }
 
    $farm = [Microsoft.SharePoint.Administration.SPFarm]::Local;
    $solutions = $farm.Solutions;
    $solutions | ForEach-Object {
        Write-Host "Found solution $_.name";
        $_.SolutionFile.SaveAs($directory + $_.name);
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment