Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

PSThreadOptions Enum

Definition

Namespace:
System.Management.Automation.Runspaces
Assembly:
System.Management.Automation.dll
Package:
Microsoft.PowerShell.5.1.ReferenceAssemblies v1.0.0
Package:
System.Management.Automation v7.4.15
Package:
System.Management.Automation v7.5.6
Package:
System.Management.Automation v7.6.1

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

These options control whether a new thread is created when a command is executed within a runspace.

public enum class PSThreadOptions
public enum PSThreadOptions
type PSThreadOptions = 
Public Enum PSThreadOptions
Inheritance
PSThreadOptions

Fields

Name Value Description
Default 0

Use the default options: UseNewThread for local Runspace, ReuseThread for local RunspacePool, server settings for remote Runspace and RunspacePool.

UseNewThread 1

Creates a new thread for each invocation.

ReuseThread 2

Creates a new thread for the first invocation and then re-uses that thread in subsequent invocations.

UseCurrentThread 3

Doesn't create a new thread; the execution occurs on the thread that calls Invoke. This option is not valid for asynchronous calls.

Applies to