Skip to content

Commit 96504e3

Browse files
matt9ucciSean Wheeler
authored andcommitted
Update Example 5 in Get-Process.md (#1923)
1 parent a935850 commit 96504e3

File tree

5 files changed

+62
-45
lines changed

5 files changed

+62
-45
lines changed

reference/3.0/Microsoft.PowerShell.Management/Get-Process.md

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,18 +80,26 @@ The first command gets all the processes on the computer and then stores them in
8080
The second command uses the InputObject parameter to pass the process objects that are stored in the $a variable to the Get-Process cmdlet.
8181
The pipeline operator passes the objects to the Format-Table cmdlet, which formats the processes by using the Priority view.
8282
The Priority view, and other views, are defined in the PS1XML format files in the Windows PowerShell home directory ($pshome).
83+
8384
### Example 5
84-
```
85-
PS C:\> get-process powershell -computername S1, localhost | ft @{Label="NPM(K)";Expression={[int]($_.NPM/1024)}}, @{Label="PM(K)";Expression={[int]($_.PM/1024)}},@{Label="WS(K)";Expression={[int]($_.WS/1024)}},@{Label="VM(M)";Expression={[int]($_.VM/1MB)}}, @{Label="CPU(s)";Expression={if ($_.CPU -ne $()) { $_.CPU.ToString("N")}}}, Id, MachineName, ProcessName -auto
85+
```powershell
86+
PS C:\> Get-Process powershell -ComputerName S1, localhost |
87+
ft @{Label = "NPM(K)"; Expression = {[int]($_.NPM / 1024)}},
88+
@{Label = "PM(K)"; Expression = {[int]($_.PM / 1024)}},
89+
@{Label = "WS(K)"; Expression = {[int]($_.WS / 1024)}},
90+
@{Label = "VM(M)"; Expression = {[int]($_.VM / 1MB)}},
91+
@{Label = "CPU(s)"; Expression = {if ($_.CPU) {$_.CPU.ToString("N")}}},
92+
Id, MachineName, ProcessName -Auto
8693
8794
NPM(K) PM(K) WS(K) VM(M) CPU(s) Id MachineName ProcessName
8895
------ ----- ----- ----- ------ -- ----------- -----------
89-
6 23500 31340 142 1980 S1 powershell
90-
6 23500 31348 142 4016 S1 powershell
91-
27 54572 54520 576 4428 localhost powershell
96+
6 23500 31340 142 1.70 1980 S1 powershell
97+
6 23500 31348 142 2.75 4016 S1 powershell
98+
27 54572 54520 576 5.52 4428 localhost powershell
9299
```
93100

94-
This example provides a Format-Table (alias = ft) command that adds the MachineName property to the standard Get-Process output display.
101+
This example provides a `Format-Table` (alias = ft) command that adds the MachineName property to the standard `Get-Process` output display.
102+
95103
### Example 6
96104
```
97105
PS C:\> get-process powershell -fileversioninfo

reference/4.0/Microsoft.PowerShell.Management/Get-Process.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,17 +103,23 @@ The pipeline operator passes the objects to the Format-Table cmdlet, which forma
103103
The Priority view, and other views, are defined in the PS1XML format files in the Windows PowerShell home directory ($pshome).
104104

105105
### Example 5
106-
```
107-
PS C:\> get-process powershell -computername S1, localhost | ft @{Label="NPM(K)";Expression={[int]($_.NPM/1024)}}, @{Label="PM(K)";Expression={[int]($_.PM/1024)}},@{Label="WS(K)";Expression={[int]($_.WS/1024)}},@{Label="VM(M)";Expression={[int]($_.VM/1MB)}}, @{Label="CPU(s)";Expression={if ($_.CPU -ne $()) { $_.CPU.ToString("N")}}}, Id, MachineName, ProcessName -auto
106+
```powershell
107+
PS C:\> Get-Process powershell -ComputerName S1, localhost |
108+
ft @{Label = "NPM(K)"; Expression = {[int]($_.NPM / 1024)}},
109+
@{Label = "PM(K)"; Expression = {[int]($_.PM / 1024)}},
110+
@{Label = "WS(K)"; Expression = {[int]($_.WS / 1024)}},
111+
@{Label = "VM(M)"; Expression = {[int]($_.VM / 1MB)}},
112+
@{Label = "CPU(s)"; Expression = {if ($_.CPU) {$_.CPU.ToString("N")}}},
113+
Id, MachineName, ProcessName -Auto
108114
109115
NPM(K) PM(K) WS(K) VM(M) CPU(s) Id MachineName ProcessName
110116
------ ----- ----- ----- ------ -- ----------- -----------
111-
6 23500 31340 142 1980 S1 powershell
112-
6 23500 31348 142 4016 S1 powershell
113-
27 54572 54520 576 4428 localhost powershell
117+
6 23500 31340 142 1.70 1980 S1 powershell
118+
6 23500 31348 142 2.75 4016 S1 powershell
119+
27 54572 54520 576 5.52 4428 localhost powershell
114120
```
115121

116-
This example provides a Format-Table (alias = ft) command that adds the MachineName property to the standard Get-Process output display.
122+
This example provides a `Format-Table` (alias = ft) command that adds the MachineName property to the standard `Get-Process` output display.
117123

118124
### Example 6
119125
```

reference/5.0/Microsoft.PowerShell.Management/Get-Process.md

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -103,22 +103,23 @@ The pipeline operator passes the objects to the **Format-Table** cmdlet, which f
103103
The Priority view, and other views, are defined in the PS1XML format files in the Windows PowerShell home directory ($pshome).
104104

105105
### Example 5: Add a property to the standard Get-Process output display
106-
```
107-
PS C:\> Get-Process Powershell -ComputerName S1, localhost | ft @{Label="NPM(K)";Expression={[int]($_.NPM/1024)}}, @{Label="PM(K)";Expression={[int]($_.PM/1024)}},@{Label="WS(K)";Expression={[int]($_.WS/1024)}},@{Label="VM(M)";Expression={[int]($_.VM/1MB)}}, @{Label="CPU(s)";Expression={if ($_.CPU -ne $()) { $_.CPU.ToString("N")}}}, Id, MachineName, ProcessName -Auto
108-
109-
110-
111-
112-
106+
```powershell
107+
PS C:\> Get-Process powershell -ComputerName S1, localhost |
108+
ft @{Label = "NPM(K)"; Expression = {[int]($_.NPM / 1024)}},
109+
@{Label = "PM(K)"; Expression = {[int]($_.PM / 1024)}},
110+
@{Label = "WS(K)"; Expression = {[int]($_.WS / 1024)}},
111+
@{Label = "VM(M)"; Expression = {[int]($_.VM / 1MB)}},
112+
@{Label = "CPU(s)"; Expression = {if ($_.CPU) {$_.CPU.ToString("N")}}},
113+
Id, MachineName, ProcessName -Auto
113114
114115
NPM(K) PM(K) WS(K) VM(M) CPU(s) Id MachineName ProcessName
115116
------ ----- ----- ----- ------ -- ----------- -----------
116-
6 23500 31340 142 1980 S1 powershell
117-
6 23500 31348 142 4016 S1 powershell
118-
27 54572 54520 576 4428 localhost powershell
117+
6 23500 31340 142 1.70 1980 S1 powershell
118+
6 23500 31348 142 2.75 4016 S1 powershell
119+
27 54572 54520 576 5.52 4428 localhost powershell
119120
```
120121

121-
This example provides a **Format-Table** (alias = ft) command that adds the **MachineName** property to the standard **Get-Process** output display.
122+
This example provides a `Format-Table` (alias = ft) command that adds the MachineName property to the standard `Get-Process` output display.
122123

123124
### Example 6: Get version information for a process
124125
```

reference/5.1/Microsoft.PowerShell.Management/Get-Process.md

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -103,22 +103,23 @@ The pipeline operator passes the objects to the **Format-Table** cmdlet, which f
103103
The Priority view, and other views, are defined in the PS1XML format files in the Windows PowerShell home directory ($pshome).
104104

105105
### Example 5: Add a property to the standard Get-Process output display
106-
```
107-
PS C:\> Get-Process Powershell -ComputerName S1, localhost | ft @{Label="NPM(K)";Expression={[int]($_.NPM/1024)}}, @{Label="PM(K)";Expression={[int]($_.PM/1024)}},@{Label="WS(K)";Expression={[int]($_.WS/1024)}},@{Label="VM(M)";Expression={[int]($_.VM/1MB)}}, @{Label="CPU(s)";Expression={if ($_.CPU -ne $()) { $_.CPU.ToString("N")}}}, Id, MachineName, ProcessName -Auto
108-
109-
110-
111-
112-
106+
```powershell
107+
PS C:\> Get-Process powershell -ComputerName S1, localhost |
108+
ft @{Label = "NPM(K)"; Expression = {[int]($_.NPM / 1024)}},
109+
@{Label = "PM(K)"; Expression = {[int]($_.PM / 1024)}},
110+
@{Label = "WS(K)"; Expression = {[int]($_.WS / 1024)}},
111+
@{Label = "VM(M)"; Expression = {[int]($_.VM / 1MB)}},
112+
@{Label = "CPU(s)"; Expression = {if ($_.CPU) {$_.CPU.ToString("N")}}},
113+
Id, MachineName, ProcessName -Auto
113114
114115
NPM(K) PM(K) WS(K) VM(M) CPU(s) Id MachineName ProcessName
115116
------ ----- ----- ----- ------ -- ----------- -----------
116-
6 23500 31340 142 1980 S1 powershell
117-
6 23500 31348 142 4016 S1 powershell
118-
27 54572 54520 576 4428 localhost powershell
117+
6 23500 31340 142 1.70 1980 S1 powershell
118+
6 23500 31348 142 2.75 4016 S1 powershell
119+
27 54572 54520 576 5.52 4428 localhost powershell
119120
```
120121

121-
This example provides a **Format-Table** (alias = ft) command that adds the **MachineName** property to the standard **Get-Process** output display.
122+
This example provides a `Format-Table` (alias = ft) command that adds the MachineName property to the standard `Get-Process` output display.
122123

123124
### Example 6: Get version information for a process
124125
```

reference/6/Microsoft.PowerShell.Management/Get-Process.md

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -108,22 +108,23 @@ The pipeline operator passes the objects to the **Format-Table** cmdlet, which f
108108
The Priority view, and other views, are defined in the PS1XML format files in the Windows PowerShell home directory ($pshome).
109109

110110
### Example 5: Add a property to the standard Get-Process output display
111-
```
112-
PS C:\> Get-Process Powershell -ComputerName S1, localhost | ft @{Label="NPM(K)";Expression={[int]($_.NPM/1024)}}, @{Label="PM(K)";Expression={[int]($_.PM/1024)}},@{Label="WS(K)";Expression={[int]($_.WS/1024)}},@{Label="VM(M)";Expression={[int]($_.VM/1MB)}}, @{Label="CPU(s)";Expression={if ($_.CPU -ne $()) { $_.CPU.ToString("N")}}}, Id, MachineName, ProcessName -Auto
113-
114-
115-
116-
117-
111+
```powershell
112+
PS C:\> Get-Process pwsh |
113+
ft @{Label = "NPM(K)"; Expression = {[int]($_.NPM / 1024)}},
114+
@{Label = "PM(K)"; Expression = {[int]($_.PM / 1024)}},
115+
@{Label = "WS(K)"; Expression = {[int]($_.WS / 1024)}},
116+
@{Label = "VM(M)"; Expression = {[int]($_.VM / 1MB)}},
117+
@{Label = "CPU(s)"; Expression = {if ($_.CPU) {$_.CPU.ToString("N")}}},
118+
Id, MachineName, ProcessName -Auto
118119
119120
NPM(K) PM(K) WS(K) VM(M) CPU(s) Id MachineName ProcessName
120121
------ ----- ----- ----- ------ -- ----------- -----------
121-
6 23500 31340 142 1980 S1 powershell
122-
6 23500 31348 142 4016 S1 powershell
123-
27 54572 54520 576 4428 localhost powershell
122+
6 23500 31340 142 1.70 1980 . pwsh
123+
6 23500 31348 142 2.75 4016 . pwsh
124+
27 54572 54520 576 5.52 4428 . pwsh
124125
```
125126

126-
This example provides a **Format-Table** (alias = ft) command that adds the **MachineName** property to the standard **Get-Process** output display.
127+
This example provides a `Format-Table` (alias = ft) command that adds the MachineName property to the standard `Get-Process` output display.
127128

128129
### Example 6: Get version information for a process
129130
```

0 commit comments

Comments
 (0)