Contact Info

Crumbtrail

ActiveXperts.com » Administration » Powershell » Powershell 4.0 » Suspend-Job

Suspend-Job - Powershell 4.0 CmdLet

ActiveXperts Network Monitor ships with integrated Powershell scripts to monitor complex network. The scripts run out of the box
Download the ActiveXperts Network Monitor FREE version now »

Suspend-Job

Short description
Temporarily stops workflow jobs.

Syntax


Description
The Suspend-Job cmdlet suspends (temporarily interrupts or pauses) workflow jobs. This cmdlet allows users who are 
running workflows to suspend the workflow. It complements the Suspend-Workflow activity, which is a command in the 
workflow that suspends the workflow.


The Suspend-Job cmdlet works only on workflow jobs. It does not work on standard background jobs, such as those that 
are started by using the Start-Job cmdlet.


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 Suspend-Job cmdlet, see the help topics for the custom job type.


When you suspend a workflow job, the workflow job runs to the next checkpoint, suspends, and immediately returns a 
workflow job object. To wait for the suspension to complete before getting the job, use the Wait parameter of 
Suspend-Job or the Wait-Job cmdlet. When the workflow job is suspended, the value of the State property of the job is 
Suspended.


Suspending correctly relies on checkpoints. The current job state, metadata, and output are saved in the checkpoint so 
the workflow job can be resumed without any loss of state or data. If the workflow job does not have checkpoints, it 
cannot be suspended properly. To add checkpoints to a workflow that you are running, use the PSPersist workflow common 
parameter. You can use the Force parameter to suspend any workflow job immediately and to suspend a workflow job that 
does not have checkpoints, but the action might cause loss of state and data.


NOTE: Before using a Job cmdlet on a custom job type, such as a workflow job (PSWorkflowJob) import the module that 
supports the custom job type, either by using the Import-Module cmdlet or using or using a cmdlet in the module.


This cmdlet is introduced in Windows PowerShell 3.0.