Retract a Solution


Scenario/Problem: You need to retract a deployed solution from a web application or global deployment.


Solution: Use the UnInstall-SPSolution cmdlet with a solution variable.

The Uninstall-SPSolution cmdlet enables you to retract a specific solution that was previously deployed. Use this in conjunction with the Get-SPSolution cmdlet (explained in a previous section), as shown in Listing 9.5.

Listing 9.5. Retracting a Solution from a Web Application


$solution = Get-SPSolution
-Identity c0e31dec-294d-4f2d-9ae4-f2e637c766bd
Uninstall-SPSolution $solution -WebApplication "SharePoint - 80"


Providing the -WebApplication parameter retracts the solution from the specified web application (assuming that the solution was deployed to that web application and has resources scoped at the web application level). You also can retract the solution from all web applications, as shown in Listing 9.6.

Listing 9.6. Retracting a Solution from All Web Applications


$solution = Get-SPSolution
-Identity c0e31dec-294d-4f2d-9ae4-f2e637c766bd
Uninstall-SPSolution $solution -AllWebApplications


If the solution is installed globally, all you need to provide to the Uninstall-SPSolution cmdlet is the solution identity, as shown in Listing 9.7.

Listing 9.7. Retracting a Solution That Was Globally Deployed


$solution = Get-SPSolution
-Identity c0e31dec-294d-4f2d-9ae4-f2e637c766bd
Uninstall-SPSolution $solution


..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.133.131.168