CmdID

CmdID / PowerShell / Cmdlets / Suspend

Suspend-Job

Temporarily stops workflow jobs. PowerShell reference

From the PowerShell reference 10 parameters Alias sujb

Opens CmdID with your command, read as PowerShell. It is read in your browser and sent nowhere.

What it does

from the PowerShell reference, CC BY 4.0

Temporarily stops workflow jobs. The Suspend-Job cmdlet suspends workflow jobs. Suspend means to temporarily interrupt or pause a workflow job. This cmdlet allows users who are running workflows to suspend the workflow. It complements the Suspend-Workflowhttps://go.microsoft.com/fwlink/?LinkId=267141 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 loss of state or data. If the workflow job does not have checkpoints, it cannot be suspended correctly. 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 could cause loss of state and data. Before you use 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 was introduced in Windows PowerShell 3.0.

Suspend-Job [-Force] [-Wait] [-Id] <Int32[]> [-WhatIf] [-Confirm] [<CommonParameters>]
Suspend-Job [-Job] <Job[]> [-Force] [-Wait] [-WhatIf] [-Confirm] [<CommonParameters>]
Suspend-Job [-Force] [-Wait] [-Name] <String[]> [-WhatIf] [-Confirm] [<CommonParameters>]
Suspend-Job [-Force] [-Wait] [-InstanceId] <Guid[]> [-WhatIf] [-Confirm] [<CommonParameters>]
Suspend-Job [-Force] [-Wait] [-Filter] <Hashtable> [-WhatIf] [-Confirm] [<CommonParameters>]
Suspend-Job [-Force] [-Wait] [-State] <JobState> [-WhatIf] [-Confirm] [<CommonParameters>]

Suspend a workflow job by name

#Sample Workflow workflow Get-SystemLog { $Events = Get-WinEvent -LogName System CheckPoint-Workflow inlinescript {\\Server01\Scripts\Analyze-SystemEvents.ps1 -Events $Events} } Get-SystemLog -AsJob -JobName "LogflowJob" Get-Job -Name LogflowJobIdentify

Trips 2 Sigma rules: highMalicious PowerShell Commandlets - ProcessCreation by Nasreddine Bencherchali (Nextron Systems); mediumEventLog Query Requests By Builtin Utilities by Ali Alwashali, Nasreddine Bencherchali (Nextron Systems)

Suspend and resume a workflow job

Suspend-Job -Name LogWorkflowJobIdentify

Suspend a workflow job on a remote computer

Invoke-Command -ComputerName Srv01 -ScriptBlock {Suspend-Job -Filter @{CustomID="031589"}Identify

Wait for the workflow job to suspend

Suspend-Job VersionCheck -WaitIdentify

Force a workflow job to suspend

Suspend-Job Maintenance -ForceIdentify

Its page in the reference: Suspend-Job.

Parameters

10 in the PowerShell reference
-FilterSpecifies a hash table of conditions. This cmdlet suspends jobs that satisfy all of the conditions. Enter a hash table where the keys are job properties and the values are job property values.
-ForceSuspends the workflow job immediately. This action could cause a loss of state and data. By default, Suspend-Job lets the workflow job run until the next checkpoint and then suspends it. You can also use this parameter to suspend workflow jobs that do not have checkpoints.
-IdSpecifies the IDs of jobs that this cmdlet suspends. The ID is an integer that uniquely identifies the job in the current session. It is easier to remember and to type than the instance ID, but it is unique only in the current session. You can type one or more IDs, separated by commas. To find the ID of a job, use the Get-Job cmdlet.
-InstanceIdSpecifies the instance IDs of jobs that this cmdlet suspends. The default is all jobs. An instance ID is a GUID that uniquely identifies the job on the computer. To find the instance ID of a job, use Get-Job.
-JobSpecifies the workflow jobs that this cmdlet stops. Enter a variable that contains the workflow jobs or a command that gets the workflow jobs. You can also pipe workflow jobs to the Suspend-Job cmdlet.
-NameSpecifies friendly names of jobs that this cmdlet suspends. Enter one or more workflow job names. Wildcard characters are supported.
-StateSpecifies a job state. This cmdlet stops only jobs in the specified state. The acceptable values for this parameter are: - NotStarted - Running - Completed - Failed - Stopped - Blocked - Suspended - Disconnected - Suspending - Stopping Suspend-Job suspends only workflow jobs in the Running state. For more information about job states, see JobState Enumeration.
-WaitIndicates that this cmdlet suppresses the command prompt until the workflow job is in the suspended state. By default, Suspend-Job returns immediately, even if the workflow job is not yet in the suspended state. The Wait parameter is equivalent to piping a Suspend-Job command to the Wait-Job cmdlet.
-ConfirmPrompts you for confirmation before running the cmdlet.
-WhatIfShows what would happen if the cmdlet runs. The cmdlet is not run.