I want to write a PowerShell script that lists all Scheduled Tasks on remote systems, and includes the user account which will be used to run each task.
The local system is running Windows 7, with PowerShell 3.0. The remote systems range from Server 2003 to 2008 R2, with PowerShell versions from 2.0 to 3.0.
What PowerShell commands or functions can I use for this task?
Best Answer
I finally wrote a script that suits my needs. This script will 'scan' all the servers listed in AD, searching in the c:\Windows\System32\tasks folder for xml files. Then it will write the value of the UserID xml node of each file, in the final CSV file.
Not yet perfect but totally working to list all tasks of all servers, and log which user account is used to run them.
The output is a comma-separated file generated on your desktop, like this one :