Using Windows PowerShell for Performance Monitoring
New in Windows 7 is the capability of using 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.
More Info For more information on using Windows PowerShell for performance monitoring, see the help for the Get-counter, Import-counter, and Export-counter cmdlets in the Windows PowerShell Cmdlet Help Topics at http://technet.microsoft.com/en-us/library/dd347701.aspx.
In this tutorial:
- Windows 7 Desktop Maintenance
- Performance Monitoring
- Improvements to Performance Monitoring in Windows 7
- Using Performance Monitor
- Real-Time Performance Monitoring
- Performance Monitor Logging
- Creating a Data Collector Set
- Configuring a Data Collector Set
- Using Data Manager to View Performance Data
- Starting and Stopping Data Logging
- Viewing Performance Data
- Comparing Performance Monitor Logs
- Performance Monitor User Rights
- Remote Data Collection
- Using Windows PowerShell for Performance Monitoring
- Resource Monitor
- Overview Tab
- CPU Tab
- Memory Tab
- Disk Tab
- Network Tab
- Reliability Monitor
- How Reliability Monitor Works
- Windows Performance Tools Kit
- Event Monitoring
- Understanding the Windows Event Architecture
- Channels
- Improvements to Event Monitoring in Windows 7
- Using Event Viewer
- Understanding Views
- Viewing Event Logs
- Saving Event Logs
- Configuring Event Subscriptions
- Considerations for Workgroup Environments
- Creating a New Subscription
- Using the Windows Events Command-Line Utility for Event Monitoring
- Using Windows PowerShell for Event Monitoring
- Using Task Scheduler
- Improvements to Task Scheduler in Windows 7
- Understanding Tasks
- Understanding the Task Scheduler Architecture
- Understanding Task Scheduler Security
- Credentials Management
- Securing Running Tasks
- Understanding AT and Task Scheduler v1.0 Compatibility Modes
- Understanding the Task Scheduler Snap-in
- Understanding Default Tasks
- Creating Tasks
- Defining Triggers
- At Startup Trigger
- On Connection To AND Disconnect From User Session Triggers
- On Workstation Lock AND Unlock Triggers
- Defining Actions
- Defining Conditions
- Defining Settings
- Managing Tasks
- Viewing History
- Using SchTasks.exe for Creating and Managing Tasks
- Task Scheduler Events
- Troubleshooting Task Scheduler
- Tasks Won't Run If the Service Is Not Started
- The Task Will Run Only When a Certain User Is Logged On
- The Task Action Failed to Execute
- Interpreting Result and Return Codes
- Understanding the Windows System Assessment Tool
- Understanding WinSAT Assessment Tests
- Examining the WinSAT Features Assessment
- Running WinSAT from the Command Line
- Understanding WinSAT Command Exit Values
- Running WinSAT Using Performance Information and Tools
- System Capabilities Section
- OEM Upsell And Help Section
- Understanding Windows Error Reporting
- Overview of Windows Error Reporting
- How WER Works
- Store Management System
- ReportArchive Folder
- WER Service
- Understanding the Error Reporting Cycle
- Understanding WER Data
- Configuring WER Using Group Policy
- Configuring WER Using the Action Center