Export dell'elenco dei Task Scheduler con PowerShell
Questo script PowerShell permette di esportare l'elenco dei task schedulati in Windows (Task Scheduler)
se si vuole salvare l'elenco in un file CSV si può usare Export-Csv
un esempio di output è questo
PowerShell
Get-ScheduledTask | % {
return [pscustomobject]@{
TaskPath = $_.TaskPath
TaskName = $_.TaskName
State = $_.State
ActionCount = $_.Actions.Count
Action = $_.Actions.Execute
TriggerEnabledCount = @($_.Triggers | Where-Object {$true -eq $_.Enabled}).Count
}
}
PowerShell
Get-ScheduledTask | % {
return [pscustomobject]@{
TaskPath = $_.TaskPath
TaskName = $_.TaskName
State = $_.State
ActionCount = $_.Actions.Count
Action = $_.Actions.Execute
TriggerEnabledCount = @($_.Triggers | Where-Object {$true -eq $_.Enabled}).Count
}
} | Export-Csv $pwd\tasks.csv
Text
#TYPE System.Management.Automation.PSCustomObject
"TaskPath","TaskName","State","ActionCount","Action","TriggerEnabledCount"
"\","GoogleUpdateTaskMachineCore","Ready","1","C:\Program Files (x86)\Google\Update\GoogleUpdate.exe","2"
"\","GoogleUpdateTaskMachineUA","Ready","1","C:\Program Files (x86)\Google\Update\GoogleUpdate.exe","1"
"\","MicrosoftEdgeUpdateTaskMachineCore","Ready","1","C:\Program Files (x86)\Microsoft\EdgeUpdate\MicrosoftEdgeUpdate.exe","2"
...
Per avere la certezza di elencare tutti i job schedulati, eseguire il comando con elevati privilegi.