Recently I needed to check for all scheduled task running on servers using a certain account as the password needed to be updated. To search for these scheduled task I used schtask.exe
I wanted to integrate this with PowerShell so that I could do some connection tests, loop through a list of devices and output the results to CSV. Below is the script I created it has three mandatory parameters for the computer list, run as account and export path.
The link to the script is below.
To run the script supple the three parameter like below. I used Check_RunAsAccount as the scrip name.
.\Check_RunAsAccount.ps1 -CompList D:\Scripts\Task_Scheduler\Complist.txt -RunAsAccount test1 -ExportLocation D:\Scripts\Task_Scheduler\
Once the script has completed there will be a result csv and if there are any non responding devices there will be a second csv. The export result will look like the below.