Last active
December 28, 2016 09:48
-
-
Save goyalmohit/a4e21514694a059ccbf6a812acd48751 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Specify the directory location to export files | |
$dirName = "c:\spbackups" | |
if(!(Test-Path $dirName)){ | |
New-Item -Path $dirName -ItemType Directory -Force | |
} | |
Write-Output Exporting solutions to $dirName | |
foreach ($solution in Get-SPSolution) | |
{ | |
$id = $solution.SolutionID | |
$title = $solution.Name | |
$filename = $solution.SolutionFile.Name | |
Write-Output "Exporting ‘$title’ to …\$filename" -nonewline | |
try { | |
$solution.SolutionFile.SaveAs("$dirName\$filename") | |
Write-Output " – done" -foreground green | |
} | |
catch | |
{ | |
Write-Output " – error : $_" -foreground red | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment