Troubleshooting Tip: Average CPU ,Memory and C Drive Usage in Parallel across Multiple Servers
,
I am using the windows PowerShell workflows to identify Average CPU ,Memory and C Drive Usage in Parallel across Multiple Servers.
It’s a quick check to see the health of servers that I use regularly to identify issues with servers.
workflow parallelUsageCheck {
param(
[int]$threads
)
$array = @()
$avg = Get-WmiObject win32_processor |
Measure-Object -property LoadPercentage -Average |
Foreach {$_.Average}
$mem = Get-WmiObject win32_operatingsystem |
Foreach {“{0:N2}” -f ((($_.TotalVisibleMemorySize – $_.FreePhysicalMemory)*100)/ $_.TotalVisibleMemorySize)}
$free = Get-WmiObject Win32_Volume -Filter “DriveLetter = ‘C:'” |
Foreach {“{0:N2}” -f (($_.FreeSpace / $_.Capacity)*100)}
$array += [pscustomobject] [ordered] @{
AverageCpu = $avg
MemoryUsage = $mem
PercentFree = $free
}
$array | Sort-Object -Property AverageCpu -Descending|select -First 10
}
Clear-Host
parallelUsageCheck -PSComputerName Server1,Server2,Server3 `
|select * -ExcludeProperty PSSourceJobInstanceId|Out-GridView
Regards,
Chaitanya