Clearing Queued jobs from SMA

First things first. You need a copy of the SMAHouseKeeping Powershell Module from here: http://www.miru.ch/troubleshooting-sma-service-management-automation-part-2/

If you are seeing this Micheal Rueefi, thank you very much for putting the time into building the module. I use it quite a bit.

After I have the module loaded I do the following:
$Queued = Get-SMAJobAssignment -JobState queued foreach ($job in $Queued) { Set-SMAJobState -jobid $job.JobId -jobstate failed }

Basically get a list of queued jobs and set them to failed.

What I have found though is that SMA jobs are still showing up as queued even when you set them to failed or another state. It looks like if you set a Job to failed you also need to set an EndTime in the Core.Jobs table. If you fail to do this the Jobs will always be listed as Queued in the (horrible) SMA interface.

To do this run the following SQL query on your SMA.Core.Jobs table:

UPDATE SMA.Core.Jobs SET EndTime = GETDATE() where endtime is null

And that should clear it out.

Jeremy Tirrell

Read more posts by this author.