SCCM How to find out the status of Predefined Maintenance Tasks

6

SCCM Maintenance TasksMany times we need to know the status of maintenance tasks running on SCCM primary servers as part of troubleshooting. To maintain, a healthy SCCM environment the maintenance tasks are very important. SCCM Maintenance Tasks results via PS or SQL.

Completion Status 0 means the task finished successfully. There is a table called SQLTaskStatus which holds this data. We can also add a column to find the time a task took to run. The query for the same would be:

select *,
floor(DATEDIFF(ss,laststarttime,lastcompletiontime)/3600) as Hours,
floor(DATEDIFF(ss,laststarttime,lastcompletiontime)/60)- floor(DATEDIFF(ss,laststarttime,lastcompletiontime)/3600)*60 as Minutes,
floor(DATEDIFF(ss,laststarttime,lastcompletiontime))- floor(DATEDIFF(ss,laststarttime,lastcompletiontime)/60)*60 as TotalSeconds
from SQLTaskStatus

Resource

Origin of the Query – It seems this link is not working now. All the credit to the original post owner.

PowerShell way of getting the status of Maintainance task across SCCM hieracrhy is here – https://gallery.technet.microsoft.com/ConfigMgr-PowerShell-31fe5bc9

6 COMMENTS

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.