script to check last job run status

I want to create a script which will check if a particular job failed last night. if it failed then the job should be disabled to run next day else should run normally. 

I know a bit to write powershell command but don't know  to save it as a file and use it similar like currently I am using bat file.

January 27th, 2015 8:54am

Are you asking about scheduled tasks?

schtasks /query /tn TestTask1

Free Windows Admin Tool Kit Click here and download it now
January 27th, 2015 9:58am

Yes its scheduled task.
January 27th, 2015 10:58am

Hi Scottichrosaviakosmos,

If you want to get the last run status of the scheduled task via Windows Powershell, please refer to the script below:

Get-ScheduledTask test1 |Get-ScheduledTaskInfo|select TaskName,LastTaskResult

And we can also save Powershell script as .ps1 file.

If there is anything else regarding this issue, please feel free to post back.

Best Regards,

Anna Wang

Free Windows Admin Tool Kit Click here and download it now
February 9th, 2015 1:16am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics