PowerShell Logo Small


This is the built-in help made by Microsoft for the command 'New-PSWorkflowExecutionOption', 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.


Creates an object that contains session configuration options for workflow sessions.


New-PSWorkflowExecutionOption [-ActivityProcessIdleTimeoutSec <Int32>] [-AllowedActivity <String[]>] [-EnableValidation] [-MaxActivityProcesses <Int32>]
[-MaxConnectedSessions <Int32>] [-MaxDisconnectedSessions <Int32>] [-MaxPersistenceStoreSizeGB <Int64>] [-MaxRunningWorkflows <Int32>] [-MaxSessionsPerRemoteNode <Int32>]
[-MaxSessionsPerWorkflow <Int32>] [-OutOfProcessActivity <String[]>] [-PersistencePath <String>] [-PersistWithEncryption] [-RemoteNodeSessionIdleTimeoutSec <Int32>]
[-SessionThrottleLimit <Int32>] [-WorkflowShutdownTimeoutMSec <Int32>] [<CommonParameters>]

Search powershellhelp.space


The New-PSWorkflowExecutionOption cmdlet creates an object that contains advanced options for workflow session configurations, that is session configurations designed to run
Windows PowerShell Workflow workflows.

You can use the PSWorkflowExecutionOption object that New-PSWorkflowExecutionOption generates as the value of the SessionTypeOption parameter of cmdlets that create or
change a session configuration, such as the Register-PSSessionConfiguration and Set-PSSessionConfiguration cmdlets.

Each parameter of the New-PSWorkflowExecutionOption cmdlet represents a property of the workflow session configuration option object that the cmdlet returns. If you omit a
parameter, the cmdlet creates the object with a default value for the property.

The New-PSWorkflowExecutionOption cmdlet is part of the Windows PowerShell Workflow feature.

You can also add workflow common parameters to this command. For more information about workflow common parameters, see about_WorkflowCommonParameters.

This cmdlet is introduced in Windows PowerShell 3.0.



Online Version: http://go.microsoft.com/fwlink/p/?linkid=287543
PSWorkflow Module
PSWorkflowUtility Module




Example 1: Create a Workflow Options Object

PS C:\>New-PSWorkflowExecutionOption -MaxSessionsPerWorkflow 10 -MaxDisconnectedSessions 200
SessionThrottleLimit : 100

PersistencePath : C:\Users\User01\AppData\Local\Microsoft\Windows\PowerShell\WF\PS

MaxPersistenceStoreSizeGB : 10

PersistWithEncryption : False

MaxRunningWorkflows : 30

AllowedActivity : {PSDefaultActivities}

OutOfProcessActivity : {InlineScript}

EnableValidation : True

MaxDisconnectedSessions : 200

MaxConnectedSessions : 100

MaxSessionsPerWorkflow : 10

MaxSessionsPerRemoteNode : 5

MaxActivityProcesses : 5

ActivityProcessIdleTimeoutSec : 60

RemoteNodeSessionIdleTimeoutSec : 60

WorkflowShutdownTimeoutMSec : 500

This command uses the New-PSWorkflowExecutionOption cmdlet to increase the MaxSessionsPerWorkflow value to 10 and decrease the MaxDisconnectedSessions value to 200.

The output shows the object that the cmdlet returns.

Example 2: Using a Workflow Options Object

The first command uses the New-PSWorkflowExecutionOption cmdlet to create a workflow options object. The command saves the object in the $wo variable.
PS C:\>$wo = New-PSWorkflowExecutionOption -MaxSessionsPerWorkflow 10 -MaxDisconnectedSessions 200

The second command uses the Register-PSSessionConfiguration cmdlet to create the ITWorkflows session configuration. To set the workflow options in the session configuration,
the command uses the SessionTypeOption parameter. The value of the SessionTypeOption parameter is the workflow options object in the $wo variable. The command also uses the
Force parameter to suppress confirmations prompts.
PS C:\>Register-PSSessionConfiguration -Name ITWorkflows -SessionTypeOption $wo -Force
WSManConfig: Microsoft.WSMan.Management\WSMan::localhost\Plugin

Type Keys Name

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

Container {Name=ITWorkflows} ITWorkflows

The third command shows the workflow options in the session configuration. The command uses the Get-PSSessionConfiguration cmdlet to the get the ITWorkflows session
configuration and the Format-List to display all properties of the session configuration in a list.The output shows that the workflow options in the session configuration.
Specifically, the session configuration has a MaxSessionsPerWorkflow property with a value of 10 and a MaxDisconnectedSessions property with a value of 200.
PS C:\>Get-PSSessionConfiguration ITWorkflows | Format-List -Property *
Architecture : 64

Filename : %windir%\system32\pwrshplugin.dll

ResourceUri : http://schemas.microsoft.com/powershell/ITWorkflows

MaxConcurrentCommandsPerShell : 1000

allowedactivity : PSDefaultActivities

UseSharedProcess : false

ProcessIdleTimeoutSec : 0

xmlns : http://schemas.microsoft.com/wbem/wsman/1/config/PluginConfiguration

MaxConcurrentUsers : 5

maxsessionsperworkflow : 10

lang : en-US

sessionconfigurationdata : <SessionConfigurationData><Param Name='PrivateData'><PrivateData><Param Name='enablevalidation' Value='True'
/><Param Name='allowedactivity' Value='PSDefaultActivities' /><Param Name='outofprocessactivity' Value='InlineScript'
/><Param Name='maxdisconnectedsessions' Value='200' /><Param Name='maxsessionsperworkflow' Value='10'

SupportsOptions : true

ExactMatch : true

RunAsUser :

IdleTimeoutms : 7200000

PSVersion : 3.0

OutputBufferingMode : Block

AutoRestart : false

MaxShells : 25

MaxMemoryPerShellMB : 1024

MaxIdleTimeoutms : 43200000

outofprocessactivity : InlineScript

SDKVersion : 2

Name : ITWorkflows

XmlRenderingType : text

Capability : {Shell}

RunAsPassword :

MaxProcessesPerShell : 15

enablevalidation : True

Enabled : True

maxdisconnectedsessions : 200

MaxShellsPerUser : 25

Permission :

This example shows how to use a workflow options object to establish or change the workflow options in a session configuration.