Gathers all scheduled tasks matching the given name query, from all AD computers matching the given name queries, and exports relevant data about them to a CSV.
The data is more or less duplicated because it is gathered in two ways: via Get-ScheduledTasks and via schtasks. This is because some computers can be in a broken state where Get-ScheduledTasks doesn't work.
- Powershell 7+ due to use of
ForEach-Object -Parallel.
- Download
Get-ScheduledTaskLike.psm1to the appropriate subdirectory of your PowerShell modules directory. - Run it using the examples and parameter documentation below.
Required string array.
The list of computer names and/or computer name query strings to poll.
Use an asterisk (*) as a wildcard.
Required string.
The distinguished name of the OU to limit the computername search to.
Required string.
A wildcard query against which to match task names. Only tasks with names which match the query will be returned.
The full task name including its path (within the folder structure of Task Scheduler) will be queried against.
Use an asterisk (*) as a wildcard.
Required string.
The directory where the output CSV file will be created.
If omitted, no CSV will be created.
The file will be named like Get-ScheduledTaskLike_<timestamp>.csv.
Optional integer.
The maximum number of computers which will be asynchronously polled simultaneously.
Default is 50.
Optional switch.
If specified, all of the task data gathered is returned in a PowerShell object.
If not specified, nothing is returned to the output stream.
- By mseng3. See my other projects here: https://github.com/mmseng/code-compendium.