Scripts for Monitoring System Performance

Downloads
94349.zip

A common task for system administrators is real-time performance monitoring, especially when diagnosing problems. Although you can use Microsoft Task Manager to manually monitor performance, using scripts saves time and effort. To simplify performance monitoring, I wrote two VBScript files, which you can download at Instant-Doc ID 94349.

Perf_prcss_detail.vbs. If you discover an unidentifiable process running on your system, you need to determine what the process is doing, if anything. When an application hangs, you might want to examine the process before you terminate it. You might also want to test a new version of a program to compare its performance characteristics with the previous version. Task Manager isn't designed to focus on a particular process. I wrote the Perf_prcss_detail.vbs script so that I can easily monitor one process and obtain detailed performance statistics.

The script outputs four columns and displays the following information:

  • Value of the counter at the time the script started
  • Value of the counter in the latest sample
  • Change in the counter since the script started
  • Change in the counter during the latest sample interval

Because the script outputs a column showing the change in the counter since the script first started running, you can observe changes in the counters over a long time interval. An interesting characteristic of Windows Management Instrumentation (WMI) is that you can query the performance statistics of a process after it has stopped. This feature lets you start a program, use the script to initiate monitoring, and see the statistics after the program has finished. Thus, you can, for example, determine how much CPU or I/O a batch program used.

Perf_prcss_detail.vbs also lets you easily monitor a process on another system. You don't need to start a Windows 2000 Server Terminal Services session, log on, and start Task Manager on the system you want to monitor.

When you run the Perf_prcss _detail.vbs script, it prompts you for the name of the target system (the default is the current system), the sample interval in seconds (the default is 3 seconds), and the process identifier (PID) of the process of interest (the default is 0 for _Total, or all processes). The script displays a list showing the name and PID of all the currently running processes so that you can easily identify the one you're interested in. If you specify a sample interval of 0 seconds, the script doesn't automatically generate output. You must instead press Enter to see updated statistics. This option lets you reduce the overhead that collecting performance statistics generates.

You must use CScript to run the script from a command prompt. The system on which you run the script and the target system must be running Windows Server 2003, Windows XP, or Win2K. To terminate the script, press Ctrl+C.

Perf_prcss_max.vbs. Sometimes your system experiences a heavy I/O load but you don't know which process is responsible. Task Manager doesn't easily provide this information; although Task Manager's Process view includes columns for cumulative I/O operations or bytes, the program doesn't show the corresponding deltas (i.e., changes during the last sample interval).

To determine which processes on my systems generate the most I/O, I wrote the script Perf_prcss_max.vbs. The script reports CPU and memory usage for comprehensive performance monitoring. The script also lets you easily obtain performance statistics without requiring you to use Terminal Services to run Task Manager on the system you want to monitor.

When you run the script, it prompts you for the name of the target system (the default is the current system), the sample interval in seconds (the default is 3 seconds), and the performance counter of interest (the default is CPU). If you specify a sample interval of 0 seconds, the script won't automatically generate output. You need to press Enter to see updated statistics.

You must use CScript to run Perf_prcss_max.vbs from a command prompt, and the system on which you run the script and the target system must be running Windows 2003, XP, or Win2K. To terminate the script, press Ctrl+C.

Discuss this Article 1

vgarquero
on Aug 13, 2011
the download link is broken. please check and let's know if there's a new link. you may also email the vbs scripts to vgarquero@yahoo.com thanks :)

Please or Register to post comments.

IT/Dev Connections

Las Vegas
September 30th - October 4th

Paul ThurottYou'll have the opportunity to experience:
• The Microsoft
Technology Roadmap
• Office 365 Implementation
• Hyper-V Optimizing
• Windows 8 Deployment
and much more!

Come See Paul Thurrott & Rod Trent in Person!

Early Registration Now Open

Upcoming Training

Mastering SharePoint 2013: Succeeding, Not Just Surviving

Building on the success of the “Mastering SharePoint 2010” seminars, the presenters have updated the content to cover the latest and greatest SharePoint product: SharePoint 2013. While SharePoint 2013 is relatively new on the marketplace, the presenters have been working with SharePoint 2013 for well over a year, and have implemented it with a number of clients in production environments.

Register Now

Current Issue

May 2013 - The NameTranslate object is useful when you need to translate Active Directory object names between different formats, but it's awkward to use from PowerShell. Here's a PowerShell script that eliminates the awkwardness.

CURRENT ISSUE / ARCHIVE / SUBSCRIBE

Windows Forums

Get answers to questions, share tips, and engage with the Windows Community in our Forums.