Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

scheduled task results - trying to get only hostname, taskname and run as user from CSV output

$
0
0

Hi

I have the following line within a ForEach loop -- $Tasks = schtasks.exe /query /s $Computer /V /FO CSV | ConvertFrom-Csv | Where { ($_.Author -ne "Microsoft Corporation") -and ($_."Run As User" -Like "*administrator")} -- which returns scheduled tasks on a server which are running as administrator. What I would like to do is take $Tasks and extract only HostName, TaskName and, Run As User information and pass this to a file. Any help greatly appreciated.

A big thanks to Martin9700 for the foundations of this script.

Pete.


Viewing all articles
Browse latest Browse all 6937

Trending Articles