Scripting. Powershell, VMware, Windows, Active Directory & Exchange. All that kind of stuff…..
RSS icon Email icon Home icon
  • PowerShell 2.0: One Cmdlet at a Time #16 Get-Job

    Posted on December 9th, 2009 Jonathan Medd No comments

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

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

    Get-Job -Command "Get-WMIObject"

    Get-JobGet-WMIObject

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

    $job = Get-Job -Command "Get-WMIObject"
    $job | Get-Member

    Get-JobObject

    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!

    Leave a reply