-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtasklist.ps1
More file actions
13 lines (10 loc) · 849 Bytes
/
tasklist.ps1
File metadata and controls
13 lines (10 loc) · 849 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
# Get running processes
$processes = Get-Process | Select-Object @{Name='Name'; Expression={$_.ProcessName}}, `
@{Name='PID'; Expression={$_.Id}}, `
@{Name='Session#'; Expression={($_ | Get-Process | Select-Object -ExpandProperty SessionId)}}, `
@{Name='Mem Usage'; Expression={"{0:N0} K" -f ($_.WS / 1KB)}}
Format the output similar to tasklist
$processes | Format-Table -Property @{Label="PID"; Expression={"$($_.PID)"}; Width=10},
@{Label="Name"; Expression={"$($_.Name)"}; Width=25},
@{Label="Session#"; Expression={"$($_.'Session#')"}; Width=10},
@{Label="Mem Usage"; Expression={"$($_.'Mem Usage')"}; Width=15}