Hi,
Im trying to get Nagios to check Windows Scheduled Tasks by Status.
Basically i want to know when tasks are Disabled or Could Not Start so i need to monitor the Status field.
I found a script on the interweb that does what i need:
@schtasks /query /fo csv | find "Could not start" | find "Disabled" /V @IF %ERRORLEVEL% EQU 1 goto NoFails1 @echo Fail:2 Task failed to Start @EXIT 2 :NoFails1 @schtasks /query /fo csv | find "Could not start" @IF %ERRORLEVEL% EQU 1 goto NoFails2 @echo Fail:1 Task Failed but Disabled @EXIT 1 :NoFails2 @echo OK:0 @EXIT 0
Now i just need to be able to modify slightly so that it excludes all system tasks and only include manual tasks.
Snag....i have no idea how to do it! :)
Anybody able to chuck in the relevant bit of code needed to exclude system tasks please?
Batch file or powershell, i dont mind, its only in a batch file as thats what i found.
THANKYOU!