Thursday, September 4, 2014

Remove and Uninstall a solution

PROBLEM: Once a solution has been added and deployed. Now, I would like to have it removed. But when i execute the install and remove command, I get this error:
The solution "xyz.wsp" has been deployed in the farm. Please retract the deployment before removing the solution.

To remove a solution you need to first uninstall it - and that will take a while, in the meantime if you execute the remove command you will get an error that would tell you to hold your horses (in boring robotic gibberish).

This script will do both in sequence and wait for the 'uninstalling' to finish before the 'remove' can execute.  

$s = get-spsolution -identity <WSP filename>.wsp 
uninstall-spsolution -identity <WSP filename>.wsp -confirm:$false

while($s.JobExists) { 
start-sleep -s 10 
remove-spsolution -identity <WSP filename>.wsp -confirm:$false

No comments: