PowerShell Genie

Get-Job

Use Get-Job to list the jobs in the session with their current state.

Command 1 min read Windows PowerShell 5.1 and PowerShell 7

Documentation: Microsoft Learn — PowerShell module reference

Syntax

1PS> Get-Job [[-Id] <int32[]>] [-Name <String[]>] [-State <JobState>] [-HasMoreData <Boolean>] [-Command <String[]>] [-IncludeChildJob] [<CommonParameters>]
See the command anatomy

Read the command and its supplied arguments. This example requires real PowerShell or its module; this diagram does not execute it.

Get-Job [[-Id] <int32[]>] [-Name <String[]>] [-State <JobState>] [-HasMoreData <Boolean>] [-Command <String[]>] [-IncludeChildJob] [<CommonParameters>]
  1. Stage 1Get-Job-Id -Name -State -HasMoreData -Command -IncludeChildJob

    Try it

    Windows PowerShell

    PowerShell example · browser support is limited.

    Execution scope: The full example below requires PowerShell outside this browser. You can edit this runner to use the supported practice commands; unsupported syntax returns an explanation.

    Interactive simulation · fictional data

    Examples

    Select Id, Name, State, HasMoreData

    1PS> Get-Job | Select-Object Id, Name, State, HasMoreData
    Show reference output

    Sample output · fictional data, shaped like the real thing

    Id  Name  State      HasMoreData
    --  ----  ---------  -----------
    1   Job1  Completed  True
    3   Job3  Running    True

    Get-Job -State Failed

    1PS> Get-Job -State Failed | Select-Object Id, Name, State
    Show reference output

    Sample output · fictional data, shaped like the real thing

    Id  Name  State
    --  ----  -----
    2   Job2  Failed

    Expand ChildJobs

    1PS> Get-Job | Select-Object -ExpandProperty ChildJobs | Select-Object Id, State
    Show reference output

    Sample output · fictional data, shaped like the real thing

    Id  State
    --  -----
    2   Completed
    4   Running

    Parameters

    Parameter definitions:

    • -Id
    • -Name
    • -State
    • -HasMoreData
    • -Command
    • -IncludeChildJob

    PowerShell module reference on Microsoft Learn

    Practical use and troubleshooting

    Practical scenario: Use Get-Job when you need to list the jobs in the session with their current state. Review syntax and sample output, then try an example in the browser lab. Start with one identified target and inspect the returned values before extending the operation to a list. Keep the identity in your report so you can trace each result back to the object or path that produced it.

    Common error and fix: A missing job can mean the query is running in another PowerShell session. Keep the job object returned by the start command or inspect IDs in the session that created it. In an unattended script, capture this failure with its original error record and record which target failed. An empty result and an unsuccessful query must remain distinguishable in the final report.

    See also: Receive-Job. Get-Job returns job metadata such as State; Receive-Job retrieves a job's output. Inspecting a Completed state is not the same as collecting its results. Read the linked command before substituting it; similar names do not imply identical inputs or output.

    Get-Job reference on Microsoft Learn

    Recap

    Get-Job Use Get-Job to list the jobs in the session with their current state.

    Next: Get-ScheduledTask
    Genie guideGet-Job

    Use Get-Job to list the jobs in the session with their current state. The console below is pre-loaded — run it, then change a value and run it again.