Monthly Archive

Categories

CTP 3 – PowerShell Jobs

While a lot of the attention around CTP3 has been concentrated on remoting and some of the brand new functionality. One thing that seems to have been overlooked is the asynchronous jobs facility.  If you set a PowerShell task, be it script or from the prompt, you cannot do anything else in that session until the task finishes and you get the prompt returned to your control. Asynchronous, or background, jobs run in the background and immediately return the prompt for further work.

There are a bunch of cmdlets for working with jobs in PowerShell

Get-Job
Receive-Job
Remove-Job
Start-Job
Stop-Job
Wait-Job

If you have been using CTP 2 notice that the cmdlets have been renamed to *-Job from *-PSJob.

Also a number of cmdlets can be invoked directly as a job by using the –AsJob parameter

Invoke-Command
Invoke-WmiMethod
Test-Connection
Restart-Computer
Stop-Computer

The PowerShell remoting functionality needs to be enabled for jobs to work -  see http://richardsiddaway.spaces.live.com/blog/cns!43CFA46A74CF3E96!1985.entry

PowerShell also needs to be started with Administrator privileges. 

Next time we will look at how to use the *-Job cmdlets.

Technorati Tags: PowerShell,CTP3,Jobs

Leave a Reply