ABK
ABK

Reputation: 41

Powershell get-scheduledjob to list jobs created by other users

Somehow I can't see scheduled jobs created by another user with get-scheduled job (can see them using task scheduler in powershell\scheduledjobs). What is the trick? powershell v3.

Upvotes: 4

Views: 3228

Answers (1)

JPBlanc
JPBlanc

Reputation: 72650

I've got some solution for you.

As you notice you can see all Scheduled Job into Task Scheduler. So I Run :

Get-ScheduledTask

and then

Get-ScheduledTask -TaskPath "\Microsoft\Windows\PowerShell\ScheduledJobs\"

So You can see all your PowerShell Jobs. I you really want ot retreive ScheduledJob objects then, you can run :

Get-ScheduledTask -TaskPath "\Microsoft\Windows\PowerShell\ScheduledJobs\" | Select-Object -ExpandProperty Actions | Select-Object -ExpandProperty Arguments | % {$_ -match '^.*= (.*);.*$'; Invoke-Expression $Matches[1]}

I just put some glue to retreive the jobs from the launch of each task.

Upvotes: 2

Related Questions