Function Get-PS { Param([string]$computer=$env:computername,[System.Management.Automation.PSCredential]$credential) if ($credential) {#use alternate credentials if supplied Get-WmiObject -Query "Select * from win32_process" -computer $computer ` -credential $credential | sort Name | Format-Table ` @{Label="Handles";Expression={$_.HandleCount}},` @{Label="NPM(K)";Expression={"{0:F0}" -f ($_.QuotaNonPagedPoolUsage/1KB)}},` @{Label="PM(K)";Expression={"{0:F0}" -f ($_.PageFileUsage/1KB)}},` @{Label="WS(K)";Expression={"{0:F0}" -f ($_.WorkingSetSize/1KB)}},` @{Label="VM(M)";Expression={"{0:F0}" -f ($_.VirtualSize/1MB)}},` @{Label="CPU(s)";Expression={"{0:N2}" -f (($_.KernelModeTime/10000000)+` ($_.UserModeTime/10000000))}},` @{Label="ID";Expression={$_.ProcessID}},` @{Label="ProcessName";Expression={$_.Name}} ` -autosize } else { Get-WmiObject -Query "Select * from win32_process" -computer $computer ` | sort Name | Format-Table ` @{Label="Handles";Expression={$_.HandleCount}},` @{Label="NPM(K)";Expression={"{0:F0}" -f ($_.QuotaNonPagedPoolUsage/1KB)}},` @{Label="PM(K)";Expression={"{0:F0}" -f ($_.PageFileUsage/1KB)}},` @{Label="WS(K)";Expression={"{0:F0}" -f ($_.WorkingSetSize/1KB)}},` @{Label="VM(M)";Expression={"{0:F0}" -f ($_.VirtualSize/1MB)}},` @{Label="CPU(s)";Expression={"{0:N2}" -f (($_.KernelModeTime/10000000)+` ($_.UserModeTime/10000000))}},` @{Label="ID";Expression={$_.ProcessID}},` @{Label="ProcessName";Expression={$_.Name}} ` -autosize } }