Shadowing Terminal Services sessions is a cool feature of Windows Server 2003 that lets you remotely control the desktop session of another Terminal Services user. You can even shadow the console session, that is, the session which the interactively logged-on user experiences at the server's console. This console session is also known as "Session 0" since it is the base or default session on a terminal server.
Let's start by reviewing how to connect with and shadow the console session on a W2K3 terminal server from an XP client machine. First you have to enable remote control on the terminal server, which in my test scenario is a standalone machine in a workgroup. You can do this as follows:
gpedit.mscand click OK to open the Group Policy Editor.
Figure 1. Enabling remote control of terminal server sessions
Next, open a command prompt on the XP client and type
mstsc -v:servername /f where servername is the IP address or name of the terminal server. This will open a Remote Desktop session from the client to the server.
Now open a new command prompt within the Remote Desktop connection you have established from your XP client and type
shadow 0 to request shadowing of the console session (session 0) on the terminal server. A dialog box should appear on the terminal server's desktop saying "<Your credentials> is requesting to control your session remotely, Do you accept the request?" Click Yes and the Remote Desktop session you have open on your XP client machine should show exactly the same as what appears on the interactively logged-on desktop of the terminal server. For example, if you open Notepad on the server, Notepad should likewise appear in the shadowed session on the client. Figure 2 shows the shadowing XP client and the shadowed terminal server side by side in a Virtual PC environment.
Figure 2. The shadowing XP client and the shadowed terminal server side by side in a Virtual PC environment. Click for full-size image.
Note that to terminate shadowing in your session from the client, press Ctrl-plus key-* where the * key from the numeric keyboard must be used.
You can also connect directly to the console session on a terminal server from an XP client. To do this, open a command prompt on the XP client and type
mstsc -v:servername /f -console but before you do it, open Notepad on the terminal server's console and type something in it. The reason for doing this is that when you connect from the XP client to the console session of the terminal server, the interactive console on the server locks. Figure 3 shows a Remote Desktop session on an XP client connected to the console session on a Windows Server 2003 machine that has Remote Desktop enabled, again within a Virtual PC environment.
Figure 3. Remote Desktop session connected to console session on Windows Server 2003 with Remote Desktop, in a Virtual PC environment. Click for full-size image.
Things work a little differently, however, in Windows XP, which has a scaled-down version of Terminal Services that only allows two (count them -- two) user sessions simultaneously. For example, say I have a box named XP194 on which I've enabled Remote Desktop using the Remote Desktop tab of System properties in Control Panel. I can then open a Remote Desktop session from XP191 to XP194 (doing so locks the console on XP194, but it does leave the console session running and any open applications running on it as well). If I try and open another Remote Desktop session to XP194, this time from XP192, my previous session initiated from XP191 is terminated. That's because Remote Desktop on XP only allows two user sessions -- in the case of Remote Desktop this is one remote session plus the console session -- at any one time.
(This is different, by the way, from how Remote Desktop works on Windows Server 2003. For example, if I enable Remote Desktop on a W2K3 box I can then open a Remote Desktop session from both XP191 and XP192 and still have access to the local console on the W2K3 box. But if I try and open a third connection from XP193, I get a message saying "The terminal server has exceeded the maximum number of allowed connections.")
Despite the limitations of Remote Desktop in XP, there is a cool hack that lets you actually shadow the console session on a Windows XP machine, and it works like this in my Virtual PC environment:
shadow 1to shadow the session opened in step 1 above. Then I switch over to XP192 and click Yes to the prompt saying "<Your credentials> is requesting to control your session remotely, Do you accept the request?"
To test the result, I tile my Virtual PC windows so I can see both XP191 and XP192 simultaneously. Then on XP192 I click the Start button and the Start menu immediately appears on XP191 as well (see Figure 4). But since my session on XP191 is actually the console on XP194 (connected through my W2K3 box), the result is that from XP192 I am shadowing the console session on XP191 (which is XP194). Pretty cool!
Figure 4. Viewing XP191 and XP192 simultaneously. Click for full-size image.
Mitch Tulloch is the author of Windows 2000 Administration in a Nutshell, Windows Server 2003 in a Nutshell, and Windows Server Hacks.
Return to the Windows DevCenter.
Copyright © 2009 O'Reilly Media, Inc.