2

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"

3 Answers 3

4

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

0

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
1
  • 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. May 18, 2012 at 0:06
0

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .