Use Windows PowerShell to Monitor System Performance

 

A new feature in Windows 7 is the ability to use Windows PowerShell for gathering performance data. Three new Windows PowerShell cmdlets provide functionality as follows: 

 

Get-counter Gets real-time performance counter data from local and remote computers.
Import-counter Imports performance counter log files and creates objects that represent each counter sample in the log.
Export-counter Exports PerformanceCounterSampleSet objects as performance counter log (.blg, .csv, .tsv) files.

For example, the following Windows PowerShell command gets the current “% Processor Time” combined values for all processors on the local computer every 2 seconds until it has 100 values and displays the captured data:
PS C:\Users\mallen>Get-counter -Counter "\Processor(_Total)\% Processor Time" -SampleInterval 2 -MaxSamples 100

The following command continuously gets the current “% Processor Time” combined values for all processors on the local computer every second (the default sampling interval) and displays the captured data until you press CTRL+C:
PS C:\Users\mallen>Get-counter -Counter "\Processor(_Total)\% Processor Time" –Continuous

You can pipe the output of the Get-counter cmdlet into the Export-counter cmdlet.For example, the following command gets the current “% Processor Time” combined values for all processors on the local computer every 2 seconds until it has 100 values and exports the captured data as a performance counter log file named Data1.blg, which is saved in the current directory (here the root folder of user Michael Allen’s user profile): 
PS C:\Users\mallen>Get-counter "\Processor(*)\% Processor Time" -SampleInterval 2 -MaxSamples 100 | Export-counter -Path $home\data1.blg

You can also pipe the output of the Import-counter cmdlet into the Export-counter cmdlet. You might do this, for example, to convert a performance monitor log file from one format to another, such as from .csv to .blg format. 

Read 195 times
KT_Austin

About:

I love my computer because all my friends live inside it

Welcome to AustinLaptop.Com

Top
We use cookies to improve our website. By continuing to use this website, you are giving consent to cookies being used. More details…