When you are maintaining SharePoint Farm, you might often want to be able to extract all SharePoint solution in the farm, import it back and deploy it.
I have seen such requirements during the migration, creation or maintenance of various environments like Pre-Prod, production etc.
After searching it on Internet, here are the 3 powershell scripts I have found:
Extract all the farm solutions:
(Get-SPFarm).Solutions | ForEach-Object{$var = "C:\<LocationUWantToStoreWSP>\" + $_.Name; $_.SolutionFile.SaveAs($var)}
Import all the farm solutions:
Get-ChildItem | ForEach-Object{Add-SPSolution -LiteralPath $_.Fullname}
Deploy all solutions to farm:
Get-SPSolution | ForEach-Object {If ($_.ContainsWebApplicationResource -eq $False) {Install-SPSolution -Identity $_ -GACDeployment} else {Install-SPSolution -Identity $_ -AllWebApplications -GACDeployment}}
I have seen such requirements during the migration, creation or maintenance of various environments like Pre-Prod, production etc.
After searching it on Internet, here are the 3 powershell scripts I have found:
Extract all the farm solutions:
(Get-SPFarm).Solutions | ForEach-Object{$var = "C:\<LocationUWantToStoreWSP>\" + $_.Name; $_.SolutionFile.SaveAs($var)}
Import all the farm solutions:
Get-ChildItem | ForEach-Object{Add-SPSolution -LiteralPath $_.Fullname}
Deploy all solutions to farm:
Get-SPSolution | ForEach-Object {If ($_.ContainsWebApplicationResource -eq $False) {Install-SPSolution -Identity $_ -GACDeployment} else {Install-SPSolution -Identity $_ -AllWebApplications -GACDeployment}}
No comments:
Post a Comment