Scheduled Tasks Audit

 green

When walking into a new client environment, one of the auditing tasks that often gets overlooked is checking the scheduled tasks in place. And it’s easy to understand why – everyone thinks it’s a laborious, manual task that would take forever in a large server farm.

Well, this script solves that problem.  Unaltered, the script below will find all scheduled tasks that failed on their last run, displaying them on the screen and saving them to a CSV file in c:\temp.

The output also includes a translation of those unreadable error codes into somewhat more meaningful text.  The output of the results is in the format of:

<server name>,<task name>,<user running the task>,<last run time>,<last run result>

scheduledtask1

Another task that comes up is finding all scheduled tasks that are run as a particular user. When changing passwords for service accounts, this kind of thing is often missed.

To search for scheduled tasks running as a specific user, change the line that tests for failures:

to this (changing the name to the account you’re looking for):

 

Or, if you just wanted a dump of every single task, remove the if statement altogether.

scheduledtask2

 green

Leave a Reply

Your email address will not be published. Required fields are marked *