다음을 통해 공유


Get-Runspace

Gets active runspaces within a PowerShell host process.

구문

NameParameterSet (기본값)

Get-Runspace
    [[-Name] <String[]>]
    [<CommonParameters>]

IdParameterSet

Get-Runspace
    [-Id] <Int32[]>
    [<CommonParameters>]

InstanceIdParameterSet

Get-Runspace
    [-InstanceId] <Guid[]>
    [<CommonParameters>]

Description

The Get-Runspace cmdlet gets active runspaces in a PowerShell host process.

예제

Example 1: Get runspaces

Get-Runspace
Id Name            ComputerName    Type          State         Availability
 -- ----            ------------    ----          -----         ------------
  1 Runspace1       localhost       Local         Opened        Busy
  2 Runspace2       localhost       Local         Opened        Available
  3 Runspace3       localhost       Local         Opened        Available

Example 2: Get runspace by Id

Get-Runspace -Id 2
Id Name            ComputerName    Type          State         Availability
 -- ----            ------------    ----          -----         ------------
  2 Runspace2       localhost       Local         Opened        Available

Example 3: Get runspace by Name

Get-Runspace -Name Runspace1
Id Name            ComputerName    Type          State         Availability
 -- ----            ------------    ----          -----         ------------
  1 Runspace1       localhost       Local         Opened        Busy

Example 4: Get runspace by InstanceId

In this example, we identify an available runspace using the Name parameter and store the return object to the variable $activeRunspace. This allows you to use the properties of the Runspace in subsequent runs of Get-Runspace.

$activeRunspace = Get-Runspace -Name Runspace1
Get-Runspace -InstanceId $activeRunspace.InstanceId
Id Name            ComputerName    Type          State         Availability
 -- ----            ------------    ----          -----         ------------
  1 Runspace1       localhost       Local         Opened        Busy

매개 변수

-Id

Specifies the Id of a runspace

매개 변수 속성

형식:

Int32[]

Default value:None
와일드카드 지원:False
DontShow:False

매개 변수 집합

IdParameterSet
Position:0
필수:True
파이프라인의 값:False
속성 이름별 파이프라인의 값:False
나머지 인수의 값:False

-InstanceId

Specifies the instance ID GUID of a running job.

매개 변수 속성

형식:

Guid[]

Default value:None
와일드카드 지원:False
DontShow:False

매개 변수 집합

InstanceIdParameterSet
Position:0
필수:True
파이프라인의 값:False
속성 이름별 파이프라인의 값:False
나머지 인수의 값:False

-Name

Specifies the Name of a runspace

매개 변수 속성

형식:

String[]

Default value:None
와일드카드 지원:False
DontShow:False

매개 변수 집합

NameParameterSet
Position:0
필수:False
파이프라인의 값:False
속성 이름별 파이프라인의 값:False
나머지 인수의 값:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

출력

Runspace

This cmdlet returns a Runspace. You can pipe the results of a Get-Runspace command to Debug-Runspace.