Contact Info

Crumbtrail

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

Suspend-Job - Powershell 3.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 runn
ing 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 ar
e 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 wh
ether 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 work
flow job object. To wait for the suspension to complete before getting the job, use the Wait parameter of Suspend-Job o
r 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 ca
nnot be suspended properly. To add checkpoints to a workflow that you are running, use the PSPersist workflow common pa
rameter. You can use the Force parameter to suspend any workflow job immediately and to suspend a workflow job that doe
s 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 sup
ports 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.