6.4. Viewing the Running Processes

Problem

You want to see all processes that are currently running on a system.

Solution

Using a graphical user interface

  1. Open the Windows Task Manager (taskmgr.exe).

  2. Click on the Processes tab.

You can also accomplish the same task using the Sysinternals Process Explorer (procexp.exe) tool.

Using a command-line interface

There are several options for viewing the running processes via the command line. You can use tasklist.exe on Windows XP and Windows Server 2003 (use the /S option to target a remote system):

> tasklist

Another Windows XP and Windows Server 2003 tool that you can use to get a process list is wmic as shown here (use the /node: option to target a remote system):

> wmic process list brief

The Sysinternals pslist.exe utility is available for Windows Server 2003 or Windows 2000 and can be run against a remote host:

> pslist \\<ServerName>

There is also the top.exe command, which is available in the Windows 2000 Resource Kit. It provides a continually updated view of the top running process (by CPU):

> top

Tip

You can do something similar to top with pslist by specifying the -s option.

Using VBScript

' This code displays the running processes on the target computer. ' ------ SCRIPT CONFIGURATION ------ strComputer = "." ' Can be a hostname or "." to target local host ' ------ END CONFIGURATION --------- set objWMI = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") set colProcesses = objWMI.InstancesOf("Win32_Process") for each objProcess In ...

Get Windows Server Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.