PowerShell裡的"工作管理員",指的就是Get-Process這個指令
例如取出本機T開頭的process:
PS C:\Projects> Get-Process -Name T*
Handles NPM(K) PM(K) WS(K) VM(M) CPU(s) Id ProcessName
------- ------ ----- ----- ----- ------ -- -----------
272 21 14608 576 141 15.58 1924 taskhost
333 29 14748 2376 362 48.25 4068 taskhost
118 12 3884 4912 110 125.22 7436 taskmgr
211 23 7684 476 65 24.69 1896 tmcsvc
141 12 3364 2964 75 182.46 332 TPAutoConnect
136 12 3028 1716 59 33.38 2876 TPAutoConnSvc
1449 36 293640 292 435 307.20 5020 TrustedInstaller
如果要取得別台機器的process呢?
PS C:\Windows\system32> Get-Process -Name T* -ComputerName web1
Handles NPM(K) PM(K) WS(K) VM(M) CPU(s) Id ProcessName
------- ------ ----- ----- ----- ------ -- -----------
138 8 4760 8020 32 2176 taskeng
188 14 6364 9540 85 16632 taskhost
225 23 9496 12736 63 1688 tmcsvc
如果某個process掛掉了,要kill某個process:
PS C:\Projects> Stop-Process -Name ssexp -Verbose
VERBOSE: Performing the operation "Stop-Process" on target "ssexp (6592)".
要停掉別台伺服器的process,就要透過Invoke-Command來做:
Invoke-Command -ComputerName web1 {Stop-Process -Name ssexp }