PowerShell Background Job Visibility

PowerShell Background Job Visibility

Q: If I create a background job in PowerShell, can I view it using the Task Scheduler?

A: Yes. PowerShell v3 introduces background jobs, which enable a trigger to be created such as a certain time, and then a block of script registered for that trigger.

Behind the scenes, the Windows task scheduler is actually being used to manage this and can be viewed by using Task Scheduler. For example, if you enter this:

PS C:\> $Trigger = New-JobTrigger –Daily –At 2am

PS C:\> Register-ScheduledJob –Name MyScheduledJob –ScriptBlock {Get-Process} –Trigger $Trigger

Then launch Task Scheduler and under Task Scheduler Library, Microsoft,  Windows, PowerShell, ScheduledJobs, the PowerShell background jobs will be visible.
 

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish