Poweshell Script to get list of top10 processes which uses maximum cpu in windows
;####
;Description: Poweshell Script to get list of top10 processes which uses maximum cpu in windows
;Created by VCP Mutthukrishna- EFFONE Technologies
;Create date : 28-02-2014
;################################################################################
$RunningProcesses=Get-Process | Sort-Object CPU -Descending
$TotalProcess=10
$ProcessCounter=1
write-host OK". " -nonewline;
Function max_cpu_usage_procs
{
foreach ($objItm in $RunningProcesses) {
if ($ProcessCounter -gt $TotalProcess)
{
break
}
Write-Host $objItm.ProcessName,"=" $objItm.CPU"; " -nonewline
$ProcessCounter = $ProcessCounter + 1
}
}
$OUTPUT=max_cpu_usage_procs
write-host $OUTPUT "|" -nonewline;
max_cpu_usage_procs