Start-Job by scheduled task and view status when logged in as user.

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...

 

No. Unless you create something by yourself what makes the jobs “logging” their progress by themselfs. As far as I know you cannot access jobs started in another instance of Powershell console.

Thanks Olaf, that’s what I thought but wanted to ask.