Is there a way i can see the status of a job when it was started by Windows scheduler?
The scheduled task runs a PowerShell script that contains the command and when I run Get-Job it shows nothing.
$jobs = @() foreach ($ticket in $tickets) { $jobs += Start-Job -Name $Ticket -ScriptBlock { param($ticket, $id) MyProcess -Ticket $ticket -id $id } -ArgumentList($Ticket,$id) }
If I run the script myself, and then run Get-Job, I do get a result.
Id Name PSJobTypeName State HasMoreData Location Command -- ---- ------------- ----- ----------- -------- ------- 7 300089 BackgroundJob Completed False localhost param($ticket, $id) M... 9 300105 BackgroundJob Completed False localhost param($ticket, $id) M... 11 300100 BackgroundJob Completed False localhost param($ticket, $id) M... 13 300102 BackgroundJob Completed False localhost param($ticket, $id) M... 15 300091 BackgroundJob Completed False localhost param($ticket, $id) M...