Skip to content

Update Example 9 in Get-Process.md #1888

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
Nov 22, 2017
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
24 changes: 15 additions & 9 deletions reference/3.0/Microsoft.PowerShell.Management/Get-Process.md
Original file line number Diff line number Diff line change
@@ -144,23 +144,29 @@ The second command uses the GetOwner method to get the owner of the process in $
The output reveals that the owner is Domain01\user01.

### Example 9
```
PS C:\> get-process powershell
```powershell
PS C:\> Get-Process powershell

Handles NPM(K) PM(K) WS(K) VM(M) CPU(s) Id ProcessName
------- ------ ----- ----- ----- ------ -- -----------
308 26 52308 61780 567 3.18 5632 powershell
377 26 62676 63384 575 3.88 5888 powershell PS C:\> get-process -id $pid
308 26 52308 61780 567 3.18 5632 powershell
377 26 62676 63384 575 3.88 5888 powershell


PS C:\> Get-Process -Id $PID

Handles NPM(K) PM(K) WS(K) VM(M) CPU(s) Id ProcessName
------- ------ ----- ----- ----- ------ -- -----------
396 26 56488 57236 575 3.90 5888 powershell
396 26 56488 57236 575 3.90 5888 powershell
```

These commands show how to use the $pid automatic variable to identify the process that is hosting the current Windows PowerShell session.
You can use this method to distinguish the host process from other Windows PowerShell processes that you might want to stop or close.
The first command gets all of the Windows PowerShell processes in the current session.
These commands show how to use the $PID automatic variable to identify the process that is hosting the current PowerShell session.
You can use this method to distinguish the host process from other PowerShell processes that you might want to stop or close.

The first command gets all of the PowerShell processes in the current session.

The second command gets the PowerShell process that is hosting the current session.

The second command gets the Windows PowerShell process that is hosting the current session.
### Example 10
```
PS C:\> get-process | where {$_.mainWindowTitle} | format-table id, name, mainwindowtitle -autosize
23 changes: 14 additions & 9 deletions reference/4.0/Microsoft.PowerShell.Management/Get-Process.md
Original file line number Diff line number Diff line change
@@ -178,23 +178,28 @@ The third command uses the GetOwner method to get the owner of the process in $p
The output reveals that the owner is Domain01\user01.

### Example 9
```
PS C:\> get-process powershell
```powershell
PS C:\> Get-Process powershell

Handles NPM(K) PM(K) WS(K) VM(M) CPU(s) Id ProcessName
------- ------ ----- ----- ----- ------ -- -----------
308 26 52308 61780 567 3.18 5632 powershell
377 26 62676 63384 575 3.88 5888 powershell PS C:\> get-process -id $pid
308 26 52308 61780 567 3.18 5632 powershell
377 26 62676 63384 575 3.88 5888 powershell


PS C:\> Get-Process -Id $PID

Handles NPM(K) PM(K) WS(K) VM(M) CPU(s) Id ProcessName
------- ------ ----- ----- ----- ------ -- -----------
396 26 56488 57236 575 3.90 5888 powershell
396 26 56488 57236 575 3.90 5888 powershell
```

These commands show how to use the $pid automatic variable to identify the process that is hosting the current Windows PowerShell session.
You can use this method to distinguish the host process from other Windows PowerShell processes that you might want to stop or close.
The first command gets all of the Windows PowerShell processes in the current session.
These commands show how to use the $PID automatic variable to identify the process that is hosting the current PowerShell session.
You can use this method to distinguish the host process from other PowerShell processes that you might want to stop or close.

The first command gets all of the PowerShell processes in the current session.

The second command gets the Windows PowerShell process that is hosting the current session.
The second command gets the PowerShell process that is hosting the current session.

### Example 10
```
18 changes: 8 additions & 10 deletions reference/5.0/Microsoft.PowerShell.Management/Get-Process.md
Original file line number Diff line number Diff line change
@@ -186,30 +186,28 @@ The third command uses the GetOwner method to get the owner of the process in $p
The output reveals that the owner is Domain01\user01.

### Example 9: Use an automatic variable to identify the process hosting the current session
```
```powershell
PS C:\> Get-Process powershell





Handles NPM(K) PM(K) WS(K) VM(M) CPU(s) Id ProcessName
------- ------ ----- ----- ----- ------ -- -----------
308 26 52308 61780 567 3.18 5632 powershell
377 26 62676 63384 575 3.88 5888 powershell PS C:\> Get-Process -Id $pid
377 26 62676 63384 575 3.88 5888 powershell


PS C:\> Get-Process -Id $PID

Handles NPM(K) PM(K) WS(K) VM(M) CPU(s) Id ProcessName
------- ------ ----- ----- ----- ------ -- -----------
396 26 56488 57236 575 3.90 5888 powershell
```

These commands show how to use the $pid automatic variable to identify the process that is hosting the current Windows PowerShell session.
You can use this method to distinguish the host process from other Windows PowerShell processes that you might want to stop or close.
The first command gets all of the Windows PowerShell processes in the current session.
These commands show how to use the $PID automatic variable to identify the process that is hosting the current PowerShell session.
You can use this method to distinguish the host process from other PowerShell processes that you might want to stop or close.

The first command gets all of the PowerShell processes in the current session.

The second command gets the Windows PowerShell process that is hosting the current session.
The second command gets the PowerShell process that is hosting the current session.

### Example 10: Get all processes that have a main window title and display them in a table
```
18 changes: 8 additions & 10 deletions reference/5.1/Microsoft.PowerShell.Management/Get-Process.md
Original file line number Diff line number Diff line change
@@ -186,30 +186,28 @@ The third command uses the GetOwner method to get the owner of the process in $p
The output reveals that the owner is Domain01\user01.

### Example 9: Use an automatic variable to identify the process hosting the current session
```
```powershell
PS C:\> Get-Process powershell





Handles NPM(K) PM(K) WS(K) VM(M) CPU(s) Id ProcessName
------- ------ ----- ----- ----- ------ -- -----------
308 26 52308 61780 567 3.18 5632 powershell
377 26 62676 63384 575 3.88 5888 powershell PS C:\> Get-Process -Id $pid
377 26 62676 63384 575 3.88 5888 powershell


PS C:\> Get-Process -Id $PID

Handles NPM(K) PM(K) WS(K) VM(M) CPU(s) Id ProcessName
------- ------ ----- ----- ----- ------ -- -----------
396 26 56488 57236 575 3.90 5888 powershell
```

These commands show how to use the $pid automatic variable to identify the process that is hosting the current Windows PowerShell session.
You can use this method to distinguish the host process from other Windows PowerShell processes that you might want to stop or close.
The first command gets all of the Windows PowerShell processes in the current session.
These commands show how to use the $PID automatic variable to identify the process that is hosting the current PowerShell session.
You can use this method to distinguish the host process from other PowerShell processes that you might want to stop or close.

The first command gets all of the PowerShell processes in the current session.

The second command gets the Windows PowerShell process that is hosting the current session.
The second command gets the PowerShell process that is hosting the current session.

### Example 10: Get all processes that have a main window title and display them in a table
```
32 changes: 15 additions & 17 deletions reference/6/Microsoft.PowerShell.Management/Get-Process.md
Original file line number Diff line number Diff line change
@@ -165,30 +165,28 @@ On Windows, the **IncludeUserName** parameter requires elevated user rights (Run
The output reveals that the owner is Domain01\user01.

### Example 9: Use an automatic variable to identify the process hosting the current session
```
PS C:\> Get-Process powershell




```powershell
PS C:\> Get-Process pwsh

Handles NPM(K) PM(K) WS(K) VM(M) CPU(s) Id ProcessName
------- ------ ----- ----- ----- ------ -- -----------
308 26 52308 61780 567 3.18 5632 powershell
377 26 62676 63384 575 3.88 5888 powershell PS C:\> Get-Process -Id $pid
NPM(K) PM(M) WS(M) CPU(s) Id SI ProcessName
------ ----- ----- ------ -- -- -----------
83 96.21 105.95 4.33 1192 10 pwsh
79 83.81 117.61 2.16 10580 10 pwsh


PS C:\> Get-Process -Id $PID

Handles NPM(K) PM(K) WS(K) VM(M) CPU(s) Id ProcessName
------- ------ ----- ----- ----- ------ -- -----------
396 26 56488 57236 575 3.90 5888 powershell
NPM(K) PM(M) WS(M) CPU(s) Id SI ProcessName
------ ----- ----- ------ -- -- -----------
83 96.21 77.53 4.39 1192 10 pwsh
```

These commands show how to use the $pid automatic variable to identify the process that is hosting the current Windows PowerShell session.
You can use this method to distinguish the host process from other Windows PowerShell processes that you might want to stop or close.
The first command gets all of the Windows PowerShell processes in the current session.
These commands show how to use the $PID automatic variable to identify the process that is hosting the current PowerShell session.
You can use this method to distinguish the host process from other PowerShell processes that you might want to stop or close.

The first command gets all of the PowerShell processes in the current session.

The second command gets the Windows PowerShell process that is hosting the current session.
The second command gets the PowerShell process that is hosting the current session.

### Example 10: Get all processes that have a main window title and display them in a table
```