# Assuming you have list of servers in servers.txt, each server name in its own line
$ComputerNames = get-content servers.txt
# Method 1 - Using the Get-Counter cmdlet
# Notice that here you can also easily add the interval and max sample sizes
Get-Counter -Counter "\Processor(_Total)\% Processor Time" -SampleInterval 10 -MaxSamples 5 -ComputerName $ComputerNames | Export-Counter -path PercentageProcessorTime.csv -fileformat csv -force
Get-WmiObject -Query "Select * from Win32_PerfFormattedData_PerfOS_Processor where name = '_Total'" -ComputerName $ComputerNames | sort PercentProcessorTime -descending | ft -Property PSComputerName, name, PercentProcessorTime -autosize
Comments
Post a Comment