PowerShell 2.0: One Cmdlet at a Time 16 Get-Job

Continuing the series looking at new cmdlets available in PowerShell 2.0. This time we look at the Get-Job cmdlet.

What can I do with it?

Get background jobs from the current session as objects.

Examples:

Get background jobs from the current session.

Get-Job

Get background jobs from the current session which contain the Get-WMIObject cmdlet.

Get-Job -Command “Get-WMIObject”

Store a job in a variable and examine it’s methods and properties.

$job = Get-Job -Command “Get-WMIObject” $job | Get-Member

How could I have done this in PowerShell 1.0?

The concept of jobs did not exist in PowerShell 1.0. You would have needed to open an extra PowerShell session whilst you waited for a command to complete in your current session.

1000 things 1% better!