ms.date | schema | locale | keywords | online version | external help file | title |
---|---|---|---|---|---|---|
2017-06-09 |
2.0.0 |
en-us |
powershell,cmdlet |
Microsoft.PowerShell.Commands.Utility.dll-Help.xml |
Get-Runspace |
Gets active runspaces within a Windows PowerShell host process.
Get-Runspace [[-Name] <String[]>] [<CommonParameters>]
Get-Runspace [-Id] <Int32[]> [<CommonParameters>]
Get-Runspace [-InstanceId] <Guid[]> [<CommonParameters>]
The Get-Runspace cmdlet gets active runspaces in a Windows PowerShell host process.
PS C:\> 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
PS C:\> Get-Runspace -Id 2
Id Name ComputerName Type State Availability
-- ---- ------------ ---- ----- ------------
2 Runspace2 localhost Local Opened Available
PS C:\> Get-Runspace -Name Runspace1
Id Name ComputerName Type State Availability
-- ---- ------------ ---- ----- ------------
1 Runspace1 localhost Local Opened Busy
PS C:\> $activeRunspace = Get-Runspace -Name Runspace1
PS C:\> Get-Runspace -InstanceId $activeRunspace.InstanceId
Id Name ComputerName Type State Availability
-- ---- ------------ ---- ----- ------------
1 Runspace1 localhost Local Opened Busy
In this example, we identify an available runspace using the Name
parameter and we store the return object to a new
variable named $activeRunspace
. The second example, we call Get-Runspace
with the InstanceId
parameter and pass
in the $activeRunspace
variable but we specify the InstanceId
property on our reuturn object.
Specifies the Id of a runspace
Type: Int32[]
Parameter Sets: IdParameterSet
Aliases:
Required: True
Position: 0
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Specifies the instance ID GUID of a running job.
Type: Guid[]
Parameter Sets: InstanceIdParameterSet
Aliases:
Required: True
Position: 0
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Specifies the Name of a runspace
Type: String[]
Parameter Sets: NameParameterSet
Aliases:
Required: False
Position: 0
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).
You can pipe the results of a Get-Runspace command to Debug-Runspace.