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.