SharePoint - export Solutions?
Discussing DR issues and dependancy's etc., I was pondering features and solutions and it struck me that if one has LOST the pre-packaged solution during a DR, how could one extract it from Config? Turns out to be dead easy...
# tell powershell to load Sharepoint DLL's
[void] [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")
[void] [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.Office.Server")
[void] [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.Office.Server.Search")
[void] [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.Office.Server.Administration.ServerFarm")
#
# connect to the farm
#
$SPfarm = [Microsoft.SharePoint.Administration.SPFarm]::get_Local()
$ver = $SPfarm.BuildVersion
Write-Output "_____________________________________________"
Write-Output "Farm Version: $ver"
Write-Output " "
$SPSolutionCollection = $SPfarm.Solutions
$SolutionCount = $SPSolutionCollection.Count
Write-Output "Solutions in Farm: $SolutionCount"
foreach ($SPsolution in $SPSolutionCollection) {
$SolutionName = $SPsolution.DisplayName
$SolutionGUID = $SPsolution.Id
$SPdeployedServers = $SPsolution.DeployedServers
$SPdeployedWebApps = $SPSolution.DeployedWebApplications
Write-Output "$SolutionGUID : $SolutionName"
if ($SPSolution.Deployed) {
Write-Output " Deployed to:"
foreach ($SPserver in $SPdeployedServers) {
$SrvrName = $SPserver.Name
Write-Output " $SrvrName"
}
}
#
# dump out the .WSP
#
$file = $SPsolution.SolutionFile
$file.SaveAs("c:\Solutions\" + $SolutionName)
}