File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed
Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -33,14 +33,15 @@ foreach($task in $tasks)
3333 $info = Get-ScheduledTaskInfo - TaskName $task.TaskName
3434 [pscustomobject ]@ {
3535 TaskName = $task.TaskName
36- Enabled = $task.Triggers.Enabled -and $task.Settings.Enabled
36+ Enabled = $task.Triggers -and $task.Triggers.Enabled -and `
37+ $task.Settings -and $task.Settings.Enabled
3738 User = $task.Principal.UserId
3839 LastRunTime = $info.LastRunTime
3940 ListTaskResult = $info.LastTaskResult
4041 Run = ' {0}> {1} {2}' -f (($task.Actions.WorkingDirectory ?? " %SystemRoot%\system32" ),
4142 ($task.Actions.Execute -replace ' \A([^"].*\s.*)\z' , ' "$1"' ),
4243 $task.Actions.Arguments | ForEach-Object {[Environment ]::ExpandEnvironmentVariables($_ )})
43- Schedule = switch ($task.Triggers. CimClass.CimClassName )
44+ Schedule = switch ($task .{ Triggers} ? .{ CimClass} ? .CimClassName)
4445 {
4546 MSFT_TaskTimeTrigger {' R/{0:yyyy-MM-ddTHH:mm:ss}/{1}' -f $task.Triggers.StartBoundary , $task.Triggers.Repetition.Interval }
4647 default {$_ }
You can’t perform that action at this time.
0 commit comments