Windows 7 / Getting Started

Monitoring and Terminating Processes

One of the basic questions about remote sessions is what processes are executing inside those sessions. Some processes are common to all sessions, but other processes tell you what users are doing in their remote sessions. You can even use processes to determine whether a user is connected to a full desktop or to a RemoteApp program. In addition, you might need to terminate a stalled process in a session or terminate all instances of a specific application.

Monitoring Application Use

You can monitor processes on an RD Session Host server or VM from the Remote Desktop Services Manager or by using the query command-line tool with the process parameter, as shown here.

query process

From the Remote Desktop Services Manager, connect to the server or VM that you want to monitor and then select the Processes tab in the middle pane to display all processes running on that server. You can then sort the table by clicking the column heading you want to sort by (Server, User, Session, ID, PID, or Image).

You can accomplish the same thing at the command prompt by running the query process or qprocess command against an RD Session Host server or a VM. The syntax for both of these commands follows.

QUERY PROCESS [* | processid | username | sessionname | /ID:nn | programname]
   [/SERVER:servername]

* 		Display all visible processes.
processid 	Display process specified by processid.
username 	Display all processes belonging to username.
sessionname 	Display all processes running at sessionname.
/ID:nn 		Display all processes running at session nn.
programname 	Display all processes associated with programname.
/SERVER:servername The RD Session Host server or VM to be queried.

You can get a list of all processes running on an RD Session Host server. For example, the following command returns all processes running on the RD Session Host server FUJI.

uery process * /server:fuji

You can also get more detailed information by specifying different parameters. For instance, to find all the processes running under sessions started by the user nancy.anderson on server FUJI, the command and data returned would look like this.

query process nancy.anderson /server:fuji
USERNAME 	SESSIONNAME   ID     PID   IMAGE
nancy.anderson 	rdp-tcp#2     4     3296   taskeng.exe
nancy.anderson 	rdp-tcp#2     4     3736   rdpclip.exe
nancy.anderson 	rdp-tcp#2     4     2680   dwm.exe
nancy.anderson 	rdp-tcp#2     4     3700   explorer.exe

Another example of getting specific process-related information from the command line is to find all instances of a particular application running on an RD Session Host server. For instance, to find all sessions in which users are running Excel.exe on server FUJI, the command and results would look like this.

query process excel.exe /server:fuji
USERNAME 		SESSIONNAME   ID    PID   IMAGE
mik.noch 		rdp-tcp#1     2     3156  excel.exe
mili.zain 		rdp-tcp#2     4     3044  excel.exe
maria.sofi 	rdp-tcp#3     5     4088  excel.exe
mich.kain 	rdp-tcp#4     6     3176  excel.exe

If you've used Windows PowerShell, you might be familiar with the Get-Process cmdlet. It's a useful tool that tells you a lot about the processes running on a computer, including working set, CPU time, and more information than qprocess can convey. Unfortunately, Get-Process is not multi-user-aware and reports only on the processes running in the current session. Similarly, you can't use the Stop-Process cmdlet very well on an RD Session Host server, because it is only aware of the processes running in the same session that it is.

[Previous] [Contents] [Next]