|
# |
|
# example: get information from schedueld tasks |
|
# |
|
|
|
$OutCSV = [System.IO.FileInfo]"c:\temp\tasks_$env:computername.csv" |
|
New-Item $OutCSV.Directory -ItemType Directory -ea 0 |
|
|
|
$TaskPath = "\*" |
|
Get-ScheduledTask -TaskPath $TaskPath | |
|
ForEach-Object { [pscustomobject]@{ |
|
Name = $_.TaskName |
|
Path = $_.TaskPath |
|
LastResult = $(($_ | Get-ScheduledTaskInfo).LastTaskResult) |
|
NextRun = $(($_ | Get-ScheduledTaskInfo).NextRunTime) |
|
Status = $_.State |
|
Command = $_.Actions.execute |
|
Arguments = $_.Actions.Arguments } |
|
} | Out-file $OutCSV |
|
|
|
get-content $outcsv |