Created
September 6, 2011 17:03
-
-
Save butaji/1198185 to your computer and use it in GitHub Desktop.
Uninstall all SharePoint solutions
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
$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