PowerShell Logo Small


This is the built-in help made by Microsoft for the command 'Resume-Job', in PowerShell version 5 - as retrieved from Windows version 'Microsoft Windows Server 2012 R2 Standard' PowerShell help files on 2016-06-23.

For PowerShell version 3 and up, where you have Update-Help, this command was run just before creating the web pages from the help files.


Restarts a suspended job


Resume-Job [-Id] <Int32[]> [-Wait] [-Confirm] [-WhatIf] [<CommonParameters>]
Resume-Job [-Filter] <Hashtable> [-Wait] [-Confirm] [-WhatIf] [<CommonParameters>]
Resume-Job [-InstanceId] <Guid[]> [-Wait] [-Confirm] [-WhatIf] [<CommonParameters>]
Resume-Job [-Job] <Job[]> [-Wait] [-Confirm] [-WhatIf] [<CommonParameters>]
Resume-Job [-Name] <String[]> [-Wait] [-Confirm] [-WhatIf] [<CommonParameters>]
Resume-Job [-State] {NotStarted | Running | Completed | Failed | Stopped | Blocked | Suspended | Disconnected | Suspending | Stopping | AtBreakpoint} [-Wait] [-Confirm]
[-WhatIf] [<CommonParameters>]

Search powershellhelp.space


The Resume-Job cmdlet resumes a workflow job that was suspended, such as by using the Suspend-Job cmdlet or the about_Suspend-Workflow activity. When a workflow job is
resumed, the job engine reconstructs the state, metadata, and output from saved resources, such as checkpoints, so the job is restarted without any loss of state or data.
The job state is changed from Suspended to Running.

Use the parameters of Resume-Job to select jobs by name, ID, instance ID or pipe a job object, such as one returned by the Get-Job cmdlet, to Resume-Job. You can also use a
property filter to select a job to be resumed.

By default, Resume-Job returns immediately, even though all jobs might not yet be resumed. To suppress the command prompt until all specified jobs are resumed, use the Wait

The Resume-Job cmdlet works only on custom job types, such as workflow jobs. It does not work on standard background jobs, such as those that are started by using the
Start-Job cmdlet. If you submit a job of an unsupported type, Resume-Job generates a terminating error and stops running.

To identify a workflow job, look for a value of PSWorkflowJob in the PSJobTypeName property of the job. To determine whether a particular custom job type supports the
Resume-Job cmdlet, see the help topics for the custom job type.

NOTE: Before using a Job cmdlet on a custom job type, import the module that supports the custom job type, either by using the Import-Module cmdlet or getting or using a
cmdlet in the module.

This cmdlet is introduced in Windows PowerShell 3.0.



Online Version: http://go.microsoft.com/fwlink/p/?linkid=289610




Example 1: Resume a job by ID

The first command uses the Get-Job cmdlet to get the job. The output shows that the job is a suspended workflow job.
PS C:\>Get-Job EventJob
Id Name PSJobTypeName State HasMoreData Location Command
-- ---- ------------- ----- ----------- -------- -------
4 EventJob PSWorkflowJob Suspended True Server01 \\Script\Share\Event.ps1

The second command uses the Id parameter of the Resume-Job cmdlet to resume the job with an Id value of 4.
PS C:\>Resume-Job -Id 4

The commands in this example verify that the job is a suspended workflow job and then resume the job.

Example 2: Resume a job by name

PS C:\>Resume-Job -Name WorkflowJob, InventoryWorkflow, WFTest*

This command uses the Name parameter to resume several workflow jobs on the local computer.

Example 3: Use custom property values

PS C:\>Resume-Job -Filter @{CustomID="T091291"} -State Suspended

This command uses the value of a custom property to identify the workflow job to resume. It uses the Filter parameter to identify the workflow job by its CustomID property.
It also uses the State parameter to verify that the workflow job is suspended, before it tries to resume it.

Example 4: Resume all suspended jobs on a remote computer

PS C:\>Invoke-Command -ComputerName Srv01 -ScriptBlock {Get-Job -State Suspended | Resume-Job}

This command resumes all suspended jobs on the Srv01 remote computer.

The command uses the Invoke-Command cmdlet to run a command on the Srv01 computer. The remote command uses the State parameter of the Get-Job cmdlet to get all suspended
jobs on the computer. A pipeline operator (|) sends the suspended jobs to the Resume-Job cmdlet, which resumes them.

Example 4: Wait for jobs to resume

PS C:\>Resume-Job -Name WorkflowJob, InventoryWorkflow, WFTest* -Wait

This command uses the Wait parameter to direct Resume-Job to return only after all specified jobs are resumed. The Wait parameter is especially useful in scripts that assume
that jobs are resumed before the script continues.

Example 5: Resume a Workflow that Suspends Itself

This code sample shows the Suspend-Workflow activity in a workflow.
Workflow Test-Suspend
$a = Get-Date
(Get-Date)- $a

The following command runs the Test-Suspend workflow on the Server01 computer.When you run the workflow, the workflow runs the Get-Date activity and saves the result in the
$a variable. Then it runs the Suspend-Workflow activity. In response, it takes a checkpoint, suspends the workflow, and returns a workflow job object. Suspend-Workflow
returns a workflow job object even if the workflow is not explicitly run as a job.
PS C:\>Test-Suspend -PSComputerName Server01
Id Name PSJobTypeName State HasMoreData Location Command

-- ---- ------------- ----- ----------- -------- -------

8 Job8 PSWorkflowJob Suspended True Server01 Test-Suspend

The following command resumes the Test-Suspend workflow in Job8. It uses the Wait parameter to hold the command prompt until the job is resumed.
PS C:\>Resume-Job -Name Job8 -Wait
Id Name PSJobTypeName State HasMoreData Location Command

-- ---- ------------- ----- ----------- -------- -------

8 Job8 PSWorkflowJob Running True Server01 Test-Suspend

This command uses the Receive-Job cmdlet to get the results of the Test-Suspend workflow. The final command in the workflow returns a TimeSpan object that represents the
elapsed time between the current date and time and the date and time that was saved in the $a variable before the workflow was suspended.
PS C:\>Receive-Job -Name Job8
Days : 0

Hours : 0

Minutes : 0

Seconds : 19

Milliseconds : 823

Ticks : 198230041

TotalDays : 0.000229432917824074

TotalHours : 0.00550639002777778

TotalMinutes : 0.330383401666667

TotalSeconds : 19.8230041

TotalMilliseconds : 19823.0041

PSComputerName : Server01

The Resume-Job cmdlet lets you resume a workflow job that was suspend by using the Suspend-Workflow activity. This activity suspends a workflow from within a workflow. It is
valid only in workflows.

For information about the Suspend-Workflow, see about_Suspend-Workflow.