Powershell Performance Monitor on multiple remote computers
There are many times you would like to gather performance data from multiple servers, with Powershell this is quite easy to accomplish.
Using this Powershell command you will gather all common performance counters for multiple server and save it to the file counter.blg
Get-counter -Counter “\PhysicalDisk(_Total)\Avg. Disk Read Queue Length”,”\Processor(_Total)\% Processor Time”,”\PhysicalDisk(_Total)\Avg. Disk Write Queue Length”,”\Memory\Available MBytes”,”\Memory\Pages/sec” -computername computername1,computername2,computername3 -Continuous | export-counter desktop\counter.blg
- “\PhysicalDisk(_Total)\Avg. Disk Read Queue Length”: This will display the number of reads on all disks connected to the machine. It is also possible to add the counter as a per disk by replacing the (_Total) with (0 C:) (Disknumber DriveLetter)
- “\PhysicalDisk(_Total)\Avg. Disk Write Queue Length”: This will display the number of writes on all disks connected to the machine. It is also possible to add the counter as a per disk by replacing the (_Total) with (0 C:) (Disknumber DriveLetter)
- “\Processor(_Total)\% Processor Time”: This counter provides a measure of how much time the processor actually spends working on productive threads and how often it was busy servicing requests.
- “\Memory\Available MBytes” : This counter indicates the amount of memory that is left after nonpaged pool allocations, paged pool allocations, process’ working sets, and the file system cache have all taken their piece.
- “\Memory\Pages/sec” : The Pages/sec counter is a combination of Pages Input/sec and Pages Output/sec counters. Recall that Page Faults/sec is a combination of hard page faults and soft page faults. This counter, however, is a general indicator of how often the system is using the hard drive to store or retrieve memory associated data.
Counter source : http://technet.microsoft.com/en-us/library/cc768048.aspx
In the parameter -computername you can specify multiple computernames seperated by a comma (,). The specified counter data will be gathered for each computer specified.
-Continuous : Gets samples continuously until you press CTRL+C.
For more information about Get-Counter see : http://technet.microsoft.com/en-us/library/hh849685.aspx
After you gathered the data for a period of time and pressed CTRL+C to stop gathering you can open the output file in the performance monitor. An example of an performance monitoring looks like this