Windows IT Pro is the leading independent community for IT professionals deploying Microsoft Windows server and client applications and technologies.
  
  
  Advanced Search 


May 08, 2006

Utility Monitors Crucial Processes

RSS
Subscribe to Windows IT Pro | See More Tips Articles Here | Reprints | Or get the Monthly Online Pass—only $5.95 a month!

Download the Code Here

I created the CheckProcess utility to monitor crucial processes on a local or remote computer. The utility is composed of two files: CheckProcess.hta, which provides the browser-based UI, and process.txt, which specifies the processes to monitor. You can download CheckProcess.hta and a sample process.txt file from the Windows Scripting Solutions Web site.

To use this utility, you must know the names of all the processes that you want to monitor and insert those names in process.txt. If you're unsure of the names, you can start those processes on your computer, then place your cursor in a blank area on the taskbar and right-click. In the menu that appears, select Task Manager. In the Windows Task Manager dialog box, select the Processes tab. On this tab, you'll find the names of the running processes in the Image Name column. Process names are case sensitive, so you must insert the names as you see them in the Image Name column. Figure 1 shows a sample process.txt file.

After you've customized the process.txt file, create a folder on your hard disk and place CheckProcess.hta and the customized process.txt file in that folder. Double-clicking CheckProcess.hta will bring up a UI similar to the one that Figure 2 shows.

The CheckProcess utility checks every 1000 milliseconds (1 second) to see whether the processes specified in process.txt file are running. When the process is running, the Status column reads UP. When the process isn't running, the Status column reads DOWN and the cell's background color changes to red.

You can change the default refresh value (i.e., 1000 milliseconds) to a different value by editing CheckProcess.hta. Open this file in Notepad and look for the line

refrTime = 1000 

If you want the utility to refresh every 2 seconds, change the 1000 value to 2000.

To check the status of processes on a remote computer, you need to change one line in CheckProcess.hta. Change the line

strComputer = "." 

to

strComputer = "remote_computer" 

where remote_computer is the remote computer's hostname (e.g., remote001). You must have the rights to execute the utility on a remote computer.

The CheckProcess utility is able to constantly check the status of processes because of the setInterval method of the Dynamic HTML (DHTML) Windows object. This method evaluates an expression every time the specified number of milliseconds elapses. The method's syntax is

Window.setInterval(exp, delay) 

where exp is the expression and delay is the number of milliseconds. In this case, the expression being evaluated is code that executes a subroutine named checkres.

The checkres subroutine uses the standard Windows Management Instrumentation (WMI) statement objWMIService.ExecQuery to prepare VBScript to execute the query

"Select * from Win32_process" 

This query retrieves the names of all the running processes. The subroutine then compares the query's list of running processes against the process.txt file's list of crucial processes. When a process is on both lists, the subroutine lists the process's name and displays its status as UP. When a process is on the process.txt file's list but not on the query's list, the subroutine lists the process's name and displays its status as DOWN. When a process is on the query's list but not on the process.txt file's list, the subroutine doesn't display any information.

   Previous  [1]  2  Next 


Top Viewed ArticlesView all articles
Command Prompt Tricks

One reader shares his tip for setting up the command prompt to reflect a remote path. ...

WinInfo Short Takes: Week of November 9, 2009

An often irreverent look at some of the week's other news, including some more Windows 7 sales momentum, some Sophos stupidity, Microsoft's cloud computing self-loathing, more whining from the browser makers, Zoho's "Fake Office," and much, much more ...

Understanding File-Size Limits on NTFS and FAT

A general confusion about files sizes on FAT seems to stem from FAT32's file-size limit of 4GB and partition-size limit of 2TB. ...


Scripting Whitepapers From Development to Production: Streamlining SharePoint Deployment with DocAve Deployment Manager

Related Events WinConnections and Microsoft® Exchange Connections

Managing IT Across Multiple Locations

7 Ways To Get More From Your SharePoint Deployment Now

Check out our list of Free Email Newsletters!

Scripting eBooks Keeping Your Business Safe from Attack: Encryption and Certificate Services

Best Practices for Managing Linux and UNIX Servers

Building an Effective Reporting System

Related Scripting Resources Introducing Left-Brain.com, the online IT bookstore
Looking for books, CDs, toolkits, eBooks? Prime your mind at Left-Brain.com

Discover Windows IT Pro eLearning Series!
Clear & detailed technical information and helpful how-to's, all in our trademark no-nonsense format


Windows IT Pro Home Register FAQ for Windows WinInfo News
Europe Edition About Us Contact Us/Customer Service Media Kit Affiliates / Licensing  
SQL Server Magazine Office & SharePoint Pro DevProConnections IT Job Hound
Left-Brain.com Technology Resource Directory asp.netPRO ITTV Windows SuperSite 
 
 Windows IT Pro is a Division of Penton Media Inc.
 © 2009 Penton Media, Inc. Terms of Use | Privacy Statement