Step 1: Save below script ExtractWSP.PS1 file
---------------------------------------------------start script------------------------
---------------------------------------------------start script------------------------
if ((Get-PSSnapin
"Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue)
-eq $null)
{
Add-PSSnapin
"Microsoft.SharePoint.PowerShell"
}
$dirName = "F:\JaisonArumugam\WSP"
Write-Host Exporting
solutions to
$dirName
foreach ($solution
in Get-SPSolution)
{
$id = $Solution.SolutionID
$title
= $Solution.Name
$filename
= $Solution.SolutionFile.Name
Write-Host "Exporting '$title' to …\$filename" -nonewline
try
{
$solution.SolutionFile.SaveAs("$dirName\$filename")
Write-Host
" – done" -foreground
green
}
catch
{
Write-Host
" – error : $_" -foreground
red
}
}
--------------------------------------------------end script----------------------------------
Save .bat file and execute run with admin..
cd /d %~dp0
powershell -noexit -file "ExtractWSP.PS1" "%CD%"
pause
No comments:
Post a Comment