Skip to content

Updated Get-Runspace Help #2032

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 11, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 50 additions & 5 deletions reference/5.1/Microsoft.PowerShell.Utility/Get-Runspace.md
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@ title: Get-Runspace
# Get-Runspace

## SYNOPSIS
Gets active runspaces within a Windows PowerShellhost process.
Gets active runspaces within a Windows PowerShell host process.

## SYNTAX

@@ -35,20 +35,62 @@ The **Get-Runspace** cmdlet gets active runspaces in a Windows PowerShell host p

## EXAMPLES

### 1:
### Example 1: Get runspaces
```powershell
PS C:\> Get-Runspace
```

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

### 2:
### Example 2: Get runspace by Id
```powershell
PS C:\> Get-Runspace -Id 2
```

```Output
Id Name ComputerName Type State Availability
-- ---- ------------ ---- ----- ------------
2 Runspace2 localhost Local Opened Available
```

### Example 3: Get runspace by Name
```powershell
PS C:\> Get-Runspace -Name Runspace1
```

```Output
Id Name ComputerName Type State Availability
-- ---- ------------ ---- ----- ------------
1 Runspace1 localhost Local Opened Busy
```

### Example 4: Get runspace by InstanceId
```powershell
PS C:\> $activeRunspace = Get-Runspace -Name Runspace1

PS C:\> Get-Runspace -InstanceId $activeRunspace.InstanceId
```

```Output
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.

## PARAMETERS

### -Id

Specifies the Id of a runspace

```yaml
Type: Int32[]
@@ -78,7 +120,7 @@ Accept wildcard characters: False
```

### -Name

Specifies the Name of a runspace

```yaml
Type: String[]
@@ -99,6 +141,9 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable

## OUTPUTS

### System.Management.Automation.Runspaces.RunspaceBase
You can pipe the results of a **Get-Runspace** command to **Debug-Runspace**.

## NOTES

## RELATED LINKS