Dela via


Get-Job

Hämtar PowerShell-bakgrundsjobb som körs i den aktuella sessionen.

Syntax

Get-Job
   [-IncludeChildJob]
   [-ChildJobState <JobState>]
   [-HasMoreData <Boolean>]
   [-Before <DateTime>]
   [-After <DateTime>]
   [-Newest <Int32>]
   [[-Id] <Int32[]>]
   [<CommonParameters>]
Get-Job
   [-IncludeChildJob]
   [-ChildJobState <JobState>]
   [-HasMoreData <Boolean>]
   [-Before <DateTime>]
   [-After <DateTime>]
   [-Newest <Int32>]
   [-State] <JobState>
   [<CommonParameters>]
Get-Job
   [-IncludeChildJob]
   [-ChildJobState <JobState>]
   [-HasMoreData <Boolean>]
   [-Before <DateTime>]
   [-After <DateTime>]
   [-Newest <Int32>]
   [-Command <String[]>]
   [<CommonParameters>]
Get-Job
   [-IncludeChildJob]
   [-ChildJobState <JobState>]
   [-HasMoreData <Boolean>]
   [-Before <DateTime>]
   [-After <DateTime>]
   [-Newest <Int32>]
   [-InstanceId] <Guid[]>
   [<CommonParameters>]
Get-Job
   [-IncludeChildJob]
   [-ChildJobState <JobState>]
   [-HasMoreData <Boolean>]
   [-Before <DateTime>]
   [-After <DateTime>]
   [-Newest <Int32>]
   [-Name] <String[]>
   [<CommonParameters>]
Get-Job
   [-Filter] <Hashtable>
   [<CommonParameters>]

Description

Cmdleten Get-Job hämtar objekt som representerar bakgrundsjobben som startades i den aktuella sessionen. Du kan använda Get-Job för att hämta jobb som har startats med hjälp av cmdleten Start-Job eller med hjälp av asjob-parametern för valfri cmdlet.

Utan parametrar hämtar kommandot Get-Job alla jobb i den aktuella sessionen. Du kan använda parametrarna för Get-Job för att hämta specifika jobb.

Jobbobjektet som Get-Job returnerar innehåller användbar information om jobbet, men det innehåller inte jobbresultatet. Använd cmdleten Receive-Job för att hämta resultaten.

Ett Windows PowerShell bakgrundsjobb är ett kommando som körs i bakgrunden utan att interagera med den aktuella sessionen. Vanligtvis använder du ett bakgrundsjobb för att köra ett komplext kommando som tar lång tid att slutföra. Mer information om bakgrundsjobb i Windows PowerShell finns i about_Jobs.

Från och med Windows PowerShell 3.0 hämtar cmdleten Get-Job även anpassade jobbtyper, till exempel arbetsflödesjobb och instanser av schemalagda jobb. Om du vill hitta jobbtypen för ett jobb använder du jobbets PSJobTypeName-egenskap .

Om du vill aktivera Get-Job för att hämta en anpassad jobbtyp importerar du modulen som stöder den anpassade jobbtypen till sessionen innan du kör ett Get-Job-kommando , antingen med hjälp av cmdleten Import-Module eller genom att använda eller hämta en cmdlet i modulen. Information om en viss typ av anpassat jobb finns i dokumentationen för funktionen för anpassad jobbtyp.

Exempel

Exempel 1: Få igång alla bakgrundsjobb i den aktuella sessionen

PS C:\> Get-Job

Det här kommandot hämtar alla bakgrundsjobb som startats i den aktuella sessionen. Den innehåller inte jobb som skapats i andra sessioner, även om jobben körs på den lokala datorn.

Exempel 2: Stoppa ett jobb med hjälp av ett instans-ID

The first command uses the **Get-Job** cmdlet to get a job. It uses the *Name* parameter to identify the job. The command stores the job object that **Get-Job** returns in the $j variable. In this example, there is only one job with the specified name.
PS C:\> $j = Get-Job -Name Job1

The second command gets the **InstanceId** property of the object in the $j variable and stores it in the $ID variable.
PS C:\> $ID = $j.InstanceID

The third command displays the value of the $ID variable.
PS C:\> $ID

Guid
----
03c3232e-1d23-453b-a6f4-ed73c9e29d55

The fourth command uses Stop-Job cmdlet to stop the job. It uses the *InstanceId* parameter to identify the job and $ID variable to represent the instance ID of the job.
PS C:\> Stop-Job -InstanceId $ID

Dessa kommandon visar hur du hämtar instans-ID:t för ett jobb och sedan använder det för att stoppa ett jobb. Till skillnad från namnet på ett jobb, som inte är unikt, är instans-ID:t unikt.

Exempel 3: Hämta jobb som innehåller ett specifikt kommando

PS C:\> Get-Job -Command "*get-process*"

Det här kommandot hämtar jobben i systemet som innehåller ett Get-Process kommando. Kommandot använder kommandoparameternför Get-Job för att begränsa de jobb som hämtas. Kommandot använder jokertecken (*) för att hämta jobb som innehåller ett Get-Process-kommando var som helst i kommandosträngen.

Exempel 4: Hämta jobb som innehåller ett specifikt kommando med hjälp av pipelinen

PS C:\> "*get-process*" | Get-Job

Precis som kommandot i föregående exempel hämtar det här kommandot jobben i systemet som innehåller ett Get-Process-kommando . Kommandot använder en pipelineoperator (|) för att skicka en sträng inom citattecken till cmdleten Get-Job . Det motsvarar föregående kommando.

Exempel 5: Hämta jobb som inte har startats

PS C:\> Get-Job -State NotStarted

Det här kommandot hämtar bara de jobb som har skapats men som ännu inte har startats. Detta inkluderar jobb som är schemalagda att köras i framtiden och de som ännu inte har schemalagts.

Exempel 6: Hämta jobb som inte har tilldelats ett namn

PS C:\> Get-Job -Name Job*

Det här kommandot hämtar alla jobb som har jobbnamn som börjar med jobbet. Eftersom jobbnummer<> är standardnamnet för ett jobb hämtar det här kommandot alla jobb som inte har ett uttryckligt tilldelat namn.

Exempel 7: Använd ett jobbobjekt för att representera jobbet i ett kommando

The first command uses the **Start-Job** cmdlet to start a background job that runs a **Get-Process** command on the local computer. The command uses the *Name* parameter of **Start-Job** to assign a friendly name to the job.
PS C:\> Start-Job -ScriptBlock {Get-Process} -Name MyJob

The second command uses Get-Job to get the job. It uses the *Name* parameter of **Get-Job** to identify the job. The command saves the resulting job object in the $j variable.
PS C:\> $j = Get-Job -Name MyJob

The third command displays the value of the job object in the $j variable. The value of the **State** property shows that the job is completed. The value of the **HasMoreData** property shows that there are results available from the job that have not yet been retrieved.
PS C:\> $j
Id     Name            PSJobTypeName   State         HasMoreData     Location             Command
--     ----            -------------   -----         -----------     --------             -------
6      MyJob           BackgroundJob   Completed     True            localhost            Get-Process

The fourth command uses the **Receive-Job** cmdlet to get the results of the job. It uses the job object in the $j variable to represent the job. You can also use a pipeline operator to send a job object to **Receive-Job**.
PS C:\> Receive-Job -Job $j
Handles  NPM(K)    PM(K)      WS(K) VM(M)   CPU(s)     Id ProcessName
-------  ------    -----      ----- -----   ------     -- -----------
    124       4    13572      12080    59            1140 audiodg
    783      16    11428      13636   100             548 CcmExec
     96       4     4252       3764    59            3856 ccmsetup
...

Det här exemplet visar hur du använder Get-Job för att hämta ett jobbobjekt och visar sedan hur du använder jobbobjektet för att representera jobbet i ett kommando.

Exempel 8: Hämta alla jobb inklusive jobb som startats med en annan metod

The first command uses the **Start-Job** cmdlet to start a job on the local computer.
PS C:\> Start-Job -ScriptBlock {Get-EventLog System}

The second command uses the *AsJob* parameter of the **Invoke-Command** cmdlet to start a job on the S1 computer. Even though the commands in the job run on the remote computer, the job object is created on the local computer, so you use local commands to manage the job.
PS C:\> Invoke-Command -ComputerName S1 -ScriptBlock {Get-EventLog System} -AsJob

The third command uses the **Invoke-Command** cmdlet to run a **Start-Job** command on the S2 computer. By using this method, the job object is created on the remote computer, so you use remote commands to manage the job.
PS C:\> Invoke-Command -ComputerName S2 -ScriptBlock {Start-Job -ScriptBlock {Get-EventLog System}}

The fourth command uses **Get-Job** to get the jobs stored on the local computer. The **PSJobTypeName** property of jobs, introduced in Windows PowerShell 3.0, shows that the local job started by using the **Start-Job** cmdlet is a background job and the job started in a remote session by using the **Invoke-Command** cmdlet is a remote job.
PS C:\> Get-Job
Id     Name       PSJobTypeName   State         HasMoreData     Location        Command
--     ----       -------------   -----         -----------     --------        -------
1      Job1       BackgroundJob   Running       True            localhost       Get-EventLog System
2      Job2       RemoteJob       Running       True            S1              Get-EventLog System

The fifth command uses **Invoke-Command** to run a **Get-Job** command on the S2 computer.The sample output shows the results of the Get-Job command. On the S2 computer, the job appears to be a local job. The computer name is localhost and the job type is a background job.For more information about how to run background jobs on remote computers, see about_Remote_Jobs.
PS C:\> Invoke-Command -ComputerName S2 -ScriptBlock {Start-Job -ScriptBlock {Get-EventLog System}}
Id    Name     PSJobTypeName  State      HasMoreData   Location   Command
--    ----     -------------  -----      -----------   -------    -------
4     Job4     BackgroundJob  Running    True          localhost  Get-Eventlog System

Det här exemplet visar att cmdleten Get-Job kan hämta alla jobb som startades i den aktuella sessionen, även om de startades med olika metoder.

Exempel 9: Undersöka ett misslyckat jobb

The first command uses the **Start-Job** cmdlet to start a job on the local computer. The job object that **Start-Job** returns shows that the job failed. The value of the **State** property is Failed.
PS C:\> Start-Job -ScriptBlock {Get-Process}
Id     Name       PSJobTypeName   State       HasMoreData     Location             Command
--     ----       -------------   -----       -----------     --------             -------
1      Job1       BackgroundJob   Failed      False           localhost            Get-Process

The second command uses the **Get-Job** cmdlet to get the job. The command uses the dot method to get the value of the **JobStateInfo** property of the object. It uses a pipeline operator to send the object in the **JobStateInfo** property to the Format-List cmdlet, which formats all of the properties of the object (*) in a list.The result of the **Format-List** command shows that the value of the **Reason** property of the job is blank.
PS C:\> (Get-Job).JobStateInfo | Format-List -Property *
State  : Failed
Reason :

The third command investigates more. It uses a **Get-Job** command to get the job and then uses a pipeline operator to send the whole job object to the **Format-List** cmdlet, which displays all of the properties of the job in a list.The display of all properties in the job object shows that the job contains a child job named Job2.
PS C:\> Get-Job | Format-List -Property *
HasMoreData   : False
StatusMessage :
Location      : localhost
Command       : get-process
JobStateInfo  : Failed
Finished      : System.Threading.ManualReset
EventInstanceId    : fb792295-1318-4f5d-8ac8-8a89c5261507
Id            : 1
Name          : Job1
ChildJobs     : {Job2}
Output        : {}
Error         : {}
Progress      : {}
Verbose       : {}
Debug         : {}
Warning       : {}
StateChanged  :

The fourth command uses **Get-Job** to get the job object that represents the Job2 child job. This is the job in which the command actually ran. It uses the dot method to get the **Reason** property of the **JobStateInfo** property.The result shows that the job failed because of an Access Denied error. In this case, the user forgot to use the Run as administrator option when starting Windows PowerShell.Because background jobs use the remoting features of Windows PowerShell, the computer must be configured for remoting to run a job, even when the job runs on the local computer.For information about requirements for remoting in Windows PowerShell, see about_Remote_Requirements. For troubleshooting tips, see about_Remote_Troubleshooting.
PS C:\> (Get-Job -Name job2).JobStateInfo.Reason
Connecting to remote server using WSManCreateShellEx api failed. The async callback gave the following error message: Access is denied.

Det här kommandot visar hur du använder jobbobjektet som Get-Job returnerar för att undersöka varför ett jobb misslyckades. Den visar också hur du hämtar underordnade jobb för varje jobb.

Exempel 10: Hämta filtrerade resultat

The first command uses the **Workflow** keyword to create the WFProcess workflow.
PS C:\> Workflow WFProcess {Get-Process}

The second command uses the *AsJob* parameter of the WFProcess workflow to run the workflow as a background job. It uses the *JobName* parameter of the workflow to specify a name for the job, and the *PSPrivateMetadata* parameter of the workflow to specify a custom ID.
PS C:\> WFProcess -AsJob -JobName WFProcessJob -PSPrivateMetadata @{MyCustomId = 92107}

The third command uses the *Filter* parameter of **Get-Job** to get the job by custom ID that was specified in the *PSPrivateMetadata* parameter.
PS C:\> Get-Job -Filter @{MyCustomId = 92107}
Id     Name            State         HasMoreData     Location             Command
--     ----            -----         -----------     --------             -------
1      WFProcessJob    Completed     True            localhost            WFProcess

Det här exemplet visar hur du använder filterparametern för att hämta ett arbetsflödesjobb. Filterparametern som introducerades i Windows PowerShell 3.0 är endast giltig för anpassade jobbtyper, till exempel arbetsflödesjobb och schemalagda jobb.

Exempel 11: Hämta information om underordnade jobb

The first command gets the jobs in the current session. The output includes a background job, a remote job and several instances of a scheduled job. The remote job, Job4, appears to have failed.
PS C:\> Get-Job
Id     Name            PSJobTypeName   State         HasMoreData     Location             Command
--     ----            -------------   -----         -----------     --------             -------
2      Job2            BackgroundJob   Completed     True            localhost            .\Get-Archive.ps1
4      Job4            RemoteJob       Failed        True            Server01, Server02   .\Get-Archive.ps1
7      UpdateHelpJob   PSScheduledJob  Completed     True            localhost            Update-Help
8      UpdateHelpJob   PSScheduledJob  Completed     True            localhost            Update-Help
9      UpdateHelpJob   PSScheduledJob  Completed     True            localhost            Update-Help
10     UpdateHelpJob   PSScheduledJob  Completed     True            localhost            Update-Help

The second command uses the *IncludeChildJob* parameter of **Get-Job**. The output adds the child jobs of all jobs that have child jobs.In this case, the revised output shows that only the Job5 child job of Job4 failed.
PS C:\> Get-Job -IncludeChildJob
Id     Name            PSJobTypeName   State         HasMoreData     Location             Command
--     ----            -------------   -----         -----------     --------             -------
2      Job2            BackgroundJob   Completed     True            localhost           .\Get-Archive.ps1
3      Job3                            Completed     True            localhost           .\Get-Archive.ps1
4      Job4            RemoteJob       Failed        True            Server01, Server02  .\Get-Archive.ps1
5      Job5                            Failed        False           Server01            .\Get-Archive.ps1
6      Job6                            Completed     True            Server02            .\Get-Archive.ps1
7      UpdateHelpJob   PSScheduledJob  Completed     True            localhost            Update-Help
8      UpdateHelpJob   PSScheduledJob  Completed     True            localhost            Update-Help
9      UpdateHelpJob   PSScheduledJob  Completed     True            localhost            Update-Help
10     UpdateHelpJob   PSScheduledJob  Completed     True            localhost            Update-Help

The third command uses the *ChildJobState* parameter with a value of Failed.The output includes all parent jobs and only the child jobs that failed.
PS C:\> Get-Job -Name Job4 -ChildJobState Failed
Id     Name            PSJobTypeName   State         HasMoreData     Location             Command
--     ----            -------------   -----         -----------     --------             -------
2      Job2            BackgroundJob   Completed     True            localhost           .\Get-Archive.ps1
4      Job4            RemoteJob       Failed        True            Server01, Server02  .\Get-Archive.ps1
5      Job5                            Failed        False           Server01            .\Get-Archive.ps1
7      UpdateHelpJob   PSScheduledJob  Completed     True            localhost            Update-Help
8      UpdateHelpJob   PSScheduledJob  Completed     True            localhost            Update-Help
9      UpdateHelpJob   PSScheduledJob  Completed     True            localhost            Update-Help
10     UpdateHelpJob   PSScheduledJob  Completed     True            localhost            Update-Help

The fifth command uses the **JobStateInfo** property of jobs and its **Reason** property to discover why Job5 failed.
PS C:\> (Get-Job -Name Job5).JobStateInfo.Reason
Connecting to remote server Server01 failed with the following error message:
Access is denied.
For more information, see the about_Remote_Troubleshooting Help topic.

Det här exemplet visar effekten av att använda parametrarna IncludeChildJob och ChildJobState i cmdleten Get-Job .

Parametrar

-After

Hämtar slutförda jobb som avslutades efter angivet datum och tid. Ange ett DateTime-objekt , till exempel ett som returneras av cmdleten Get-Date eller en sträng som kan konverteras till ett DateTime-objekt , till exempel Dec 1, 2012 2:00 AM eller 11/06.

Den här parametern fungerar bara på anpassade jobbtyper, till exempel arbetsflödesjobb och schemalagda jobb, som har en EndTime-egenskap . Det fungerar inte på standardbakgrundsjobb, till exempel de som skapas med hjälp av cmdleten Start-Job . Information om stöd för den här parametern finns i hjälpavsnittet för jobbtypen.

Den här parametern introducerades i Windows PowerShell 3.0.

Type:DateTime
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Before

Hämtar slutförda jobb som avslutades före angivet datum och tid. Ange ett DateTime-objekt .

Den här parametern fungerar bara på anpassade jobbtyper, till exempel arbetsflödesjobb och schemalagda jobb, som har en EndTime-egenskap . Det fungerar inte på standardbakgrundsjobb, till exempel de som skapas med hjälp av cmdleten Start-Job . Information om stöd för den här parametern finns i hjälpavsnittet för jobbtypen.

Den här parametern introducerades i Windows PowerShell 3.0.

Type:DateTime
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ChildJobState

Hämtar endast de underordnade jobb som har det angivna tillståndet. De acceptabla värdena för den här parametern är:

  • NotStarted
  • Körs
  • Slutförd
  • Misslyckad
  • Stoppad
  • Blockerad
  • Inaktiverad
  • Frånkopplad
  • Pausar
  • Stoppas

Som standard får Get-Job inte underordnade jobb. Med parametern IncludeChildJob hämtar Get-Job alla underordnade jobb. Om du använder parametern ChildJobState har parametern IncludeChildJob ingen effekt.

Den här parametern introducerades i Windows PowerShell 3.0.

Type:JobState
Accepted values:NotStarted, Running, Completed, Failed, Stopped, Blocked, Suspended, Disconnected, Suspending, Stopping, AtBreakpoint
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Command

Anger en matris med kommandon som strängar. Den här cmdleten hämtar jobben som innehåller de angivna kommandona. Standardvärdet är alla jobb. Du kan använda jokertecken för att ange ett kommandomönster.

Type:String[]
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:True

-Filter

Anger en hash-tabell med villkor. Den här cmdleten hämtar jobb som uppfyller alla villkor. Ange en hash-tabell där nycklarna är jobbegenskaper och värdena är jobbegenskapsvärden.

Den här parametern fungerar bara på anpassade jobbtyper, till exempel arbetsflödesjobb och schemalagda jobb. Det fungerar inte på standardbakgrundsjobb, till exempel de som skapas med hjälp av cmdleten Start-Job . Information om stöd för den här parametern finns i hjälpavsnittet för jobbtypen.

Den här parametern introducerades i Windows PowerShell 3.0.

Type:Hashtable
Position:0
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-HasMoreData

Anger om denna cmdlet endast hämtar jobb som har det angivna egenskapsvärdet HasMoreData . Egenskapen HasMoreData anger om alla jobbresultat har tagits emot i den aktuella sessionen. Om du vill hämta jobb som har fler resultat anger du värdet $True. Om du vill hämta jobb som inte har fler resultat anger du värdet $False.

Om du vill hämta resultatet av ett jobb använder du cmdleten Receive-Job.

När du använder cmdleten Receive-Job tas de resultat som returneras bort från den minnesinterna sessionsspecifika lagringen bort. När det har returnerat alla resultat för jobbet i den aktuella sessionen anges värdet för hasmoredata-egenskapen för jobbet till $False) för att indikera att det inte har fler resultat för jobbet i den aktuella sessionen. Använd parametern Behåll för Receive-Job för att förhindra att Receive-Job tar bort resultat och ändrar värdet för egenskapen HasMoreData . För mer information ange Get-Help Receive-Job.

Egenskapen HasMoreData är specifik för den aktuella sessionen. Om resultat för en anpassad jobbtyp sparas utanför sessionen, till exempel den schemalagda jobbtypen, som sparar jobbresultat på disk, kan du använda cmdleten Receive-Job i en annan session för att få jobbresultatet igen, även om värdet för HasMoreData är $False. Mer information finns i hjälpavsnitten för den anpassade jobbtypen.

Den här parametern introducerades i Windows PowerShell 3.0.

Type:Boolean
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Id

Anger en matris med ID:t för jobb som denna cmdlet hämtar.

ID:t är ett heltal som unikt identifierar jobbet i den aktuella sessionen. Det är lättare att komma ihåg och att skriva än instans-ID, men det är bara unikt i den aktuella sessionen. Du kan skriva ett eller flera ID:er avgränsade med kommatecken. Om du vill hitta ID:t för ett jobb skriver du Get-Job utan parametrar.

Type:Int32[]
Position:0
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-IncludeChildJob

Anger att denna cmdlet returnerar underordnade jobb, förutom överordnade jobb.

Den här parametern är särskilt användbar för att undersöka arbetsflödesjobb, där Get-Job returnerar ett överordnat containerjobb och jobbfel, eftersom orsaken till felet sparas i en egenskap för det underordnade jobbet.

Den här parametern introducerades i Windows PowerShell 3.0.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-InstanceId

Anger en matris med instans-ID:t för jobb som denna cmdlet hämtar. Standardvärdet är alla jobb.

Ett instans-ID är ett GUID som unikt identifierar jobbet på datorn. Om du vill hitta instans-ID för ett jobb använder du Get-Job.

Type:Guid[]
Position:0
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-Name

Anger en matris med egna instansnamn för jobb som den här cmdleten hämtar. Ange ett jobbnamn eller använd jokertecken för att ange ett jobbnamnsmönster. Som standard hämtar Get-Job alla jobb i den aktuella sessionen.

Type:String[]
Position:0
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:True

-Newest

Anger ett antal jobb som ska hämtas. Den här cmdleten hämtar de jobb som avslutades senast.

Parametern Newest sorterar eller returnerar inte de senaste jobben i sluttidsordning. Om du vill sortera utdata använder du cmdleten Sort-Object.

Den här parametern introducerades i Windows PowerShell 3.0.

Type:Int32
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-State

Anger ett jobbtillstånd. Den här cmdleten hämtar endast jobb i det angivna tillståndet. De acceptabla värdena för den här parametern är:

  • NotStarted
  • Körs
  • Slutförd
  • Misslyckad
  • Stoppad
  • Blockerad
  • Inaktiverad
  • Frånkopplad
  • Pausar
  • Stoppas

Som standard hämtar Get-Job alla jobb i den aktuella sessionen.

Mer information om jobbtillstånd finns i JobState-uppräkning i MSDN-biblioteket.

Type:JobState
Accepted values:NotStarted, Running, Completed, Failed, Stopped, Blocked, Suspended, Disconnected, Suspending, Stopping, AtBreakpoint
Position:0
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

Indata

None

Du kan inte skicka indata till denna cmdlet.

Utdata

System.Management.Automation.RemotingJob

Den här cmdleten returnerar objekt som representerar jobben i sessionen.

Kommentarer

  • Egenskapen PSJobTypeName för jobb anger jobbets jobbtyp. Egenskapsvärdet bestäms av jobbtypens författare. I följande lista visas vanliga jobbtyper.

    • BackgroundJob. Det lokala jobbet startades med startjobbet.

    • RemoteJob. Jobbet startades i en PSSession med hjälp av asjob-parametern för cmdleten Invoke-Command.

    • PSWorkflowJob. Jobbet startades med hjälp av den vanliga AsJob-parametern för arbetsflöden.