Author Topic: Use Windows PowerShell to Monitor System Performance  (Read 3389 times)

0 Members and 1 Guest are viewing this topic.

Use Windows PowerShell to Monitor System Performance
« on: June 11, 2010, 07:10:30 PM »

Offline Nick

  • Administrator
  • Platinum Member
  • *
  • Posts: 46028
  • Karma: +1000/-0
  • Gender: Male
  • NickCS
    • http://www.facebook.com/nickcomputerservices
    • http://www.twitter.com/nickcomputer
    • Computer Chiangmai

Use Windows PowerShell to Monitor System Performance

A new feature in Windows 7, you can now use Windows PowerShell to gather performance data. Learn how to use the three new cmdlets that make this possible.


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 Exports PerformanceCounterSampleSet objects as performance counter log (.blg, .csv, .tsv) files.

Export-counter Imports performance counter log files and creates objects that represent each counter sample in the log.

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.


From the Microsoft Press book Windows 7 Resource Kit by Mitch Tulloch, Tony Northrup, Jerry Honeycutt, Ed Wilson, and the Windows 7 team.

credit: technet.microsoft.com


 
Share this topic...
In a forum
(BBCode)
In a site/blog
(HTML)


Related Topics

  Subject / Started by Replies Last post
0 Replies
5422 Views
Last post June 11, 2010, 04:51:16 PM
by Nick
0 Replies
3422 Views
Last post June 11, 2010, 05:06:58 PM
by Nick
0 Replies
3772 Views
Last post June 11, 2010, 06:56:51 PM
by Nick
0 Replies
3994 Views
Last post June 16, 2010, 02:10:11 PM
by Nick
0 Replies
2413 Views
Last post July 02, 2010, 05:19:25 PM
by Nick
0 Replies
3852 Views
Last post July 03, 2010, 03:07:23 PM
by Nick
0 Replies
4128 Views
Last post July 03, 2010, 03:11:45 PM
by Nick
0 Replies
4974 Views
Last post July 03, 2010, 03:15:40 PM
by Nick
0 Replies
4172 Views
Last post July 03, 2010, 03:16:32 PM
by Nick
0 Replies
11018 Views
Last post August 05, 2011, 07:23:26 PM
by Nick