I've been trying to remove my solution from Sharepoint 2007 but getting an error on the Central Admin page and when I do

stsadm -o deletesolution -name MySolution.wsp -override

from command line it returns the follwoing error message

"The solution cannot be removed when a job is scheduled or running"


The best solution I found was from this link: Removing malfunctioning Windows SharePoint Services solutions. I basically didn't have WSS Administration service running.

  1. Do

    stsadm -o enumsolutions
  2. Copy id from the retraction SolutionDeploymentJob

  3. Do

    stsadm -o canceldeployment -id [SolutionDeploymentJob id]
  4. Start WSS Administration service and change it to start automatically

  5. Run

    stsadm -o execadmsvcjobs
  6. Retract and remove solution from Central Admin as you meant to do it before

| improve this answer | |

Often, deletesolution is preceded by retractsolution. However, as the error message states, retractsolution can take awhile to run even when not scheduled for later execution. To force, retractsolution to run and finish, call execadmsvcjobs before trying other operations.

stsadm -o retractsolution -name MySolution.wsp -immediate
stsadm -o execadmsvcjobs
stsadm -o deletesolution -name MySolution.wsp
| improve this answer | |
  • 1
    I tried to retract solution from Central Admin first. That what put the whole system in the error state. The problem was in WSS Administration service being not started (very nooby mistake I believe). But thanks, your answer was very close. – Oleg Sakharov May 18 '12 at 0:06

The solution is very simple. If you run the Uninstall command then in the background its doing something. So the approach is give sometime between the UnInstall command and the Remove command.

This approach worked for me. My powershell script waits until the solution is uninstalled before attempting to remove it.

    Uninstall-SPSolution -Identity "$solutionName" -AllWebApplications -Confirm:$false

    #waiting for uninstall to complete
    $wspSolutionForUninstall = Get-SPSolution -Identity:$solutionName

    while ($wspSolutionForUninstall.JobExists) {
        Write-Host '.' -NoNewline
        sleep -Seconds:1
        $wspSolutionForUninstall = Get-SPSolution -Identity:$solutionName

    Remove-SPSolution -Identity $solutionName -Confirm:$false -force

Reference: http://www.fewlines4biju.com/2012/05/solution-cannot-be-removed-when-job-is.html

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.