Skip to content

Instantly share code, notes, and snippets.

@butaji
Created September 6, 2011 17:03
Show Gist options
  • Save butaji/1198185 to your computer and use it in GitHub Desktop.
Save butaji/1198185 to your computer and use it in GitHub Desktop.
Uninstall all SharePoint solutions
$ver = $host | select version
if ($ver.Version.Major -gt 1) {$Host.Runspace.ThreadOptions = "ReuseThread"}
Add-PsSnapin Microsoft.SharePoint.PowerShell
$spAdminServiceName = "SPAdminV4"
Stop-Service -Name $spAdminServiceName
$deployedSolutions = Get-SPSolution | Where-Object {$_.Deployed -eq $true}
if($deployedSolutions)
{
foreach($solution in $deployedSolutions)
{
if($solution.ContainsWebApplicationResource)
{
$solution | Uninstall-SPSolution -AllWebApplications -Confirm:$false
}
else
{
$solution | Uninstall-SPSolution -Confirm:$false
}
}
}
Start-SPAdminJob
Get-SPSolution | Remove-SPSolution -Confirm:$false
Start-Service -Name $spAdminServiceName
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment