Retract and Uninstall SharePoint Solution via Powershell


/ Published in: Windows PowerShell
Save to your folder(s)



Copy this code and paste it in your HTML
  1. Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction "SilentlyContinue"
  2. $SolutionPackageName = "MySolution.wsp"
  3. $solution = Get-SPSolution | where-object {$_.Name -eq $SolutionPackageName}
  4.  
  5. # check to see if solution package has been installed
  6. if ($solution -ne $null) {
  7. # check to see if solution package is currently deployed
  8. if($solution.Deployed -eq $true){
  9. Uninstall-SPSolution -Identity $SolutionPackageName -Local -Confirm:$false
  10. }
  11. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.