I <3 Steve McConnell*
Coding Horror
programming and human factors
by Jeff Atwood

February 25, 2005

Remotely Managing Remote Desktop

Some of my coworkers have an annoying habit of remoting into our Win2k servers and never logging out. They also like to do this in pairs, which means nobody else can remote into the machines due to Microsoft's default two-user administrative mode Terminal Services limit. Yeah, I could rclient in, or use remote MMC snap-ins, but sometimes it's just faster to manipulate the GUI via Remote Desktop.

There's a tool to remotely manage remote desktop connections in Win2k, but I couldn't find any equivalent in XP. A little searching turned up Microsoft's Windows Server 2003 Administration Tools Pack which provides server management tools that allow administrators to remotely manage Windows 2000 Servers & Windows Server 2003 family servers. And indeed it does! The kit installs the following tools, which appear under the Start, Programs, Administrative Tools menu:

  • Active Directory Domains and Trusts
  • Active Directory Management
  • Active Directory Sites and Services
  • Active Directory Users and Computers
  • Authorization Manager
  • Cluster Administrator
  • Connection Manager Administration Kit
  • DHCP
  • Distributed File System
  • DNS
  • IP Address Management
  • Network Load Balancing Manager
  • Public Key Management
  • Remote Desktops
  • Remote Storage
  • Telephony
  • Terminal Server Licensing
  • Terminal Services Manager
  • UDDI Services
  • WINS

All this for the low, low price of nothing. The only part I care about is the Terminal Services Manager, which lets me terminate idle remote desktop sessions from target servers. Take that coworkers!

Posted by Jeff Atwood    View blog reactions

 

« Pentium-M Home Theater PC iPod Hacking via Modem »

 

Comments

You could also fire up the ts client using "mstsc /console" and kick them off that way. ;)

Kurt on February 26, 2005 09:17 AM

You could disconnect them from a command prompt with tsdiscon:
tsdiscon 1 /server:fabrikam

Or reset their session with rwinsta:
rwinsta 1 /server:fabrikam

If you wanted to be picky/choosy about Who you disconnect/reset, you can view session info with qwinsta:
qwinsta /server:fabrikam

A couple other command line tools are tsshutdn (shutdown/reboot machine) and tskill (kill process).

I believe these are all available on Windows XP by default.

Rob on February 27, 2005 12:00 AM

Running Terminal Services Manager from my home machine wouldn't connect to the remote machine. the rwinsta command doesn't have any facility for entering credentials.

My remote server is hosted by 1and1.

Haacked on October 14, 2005 12:25 AM

Thank you very much! These commands are VERY useful.

K on May 8, 2006 06:19 PM

After reading this article looking for a Remote Connection Manager and realizing that the old MS mmc kinda stunk I built a connection manager using .net 2. I hope it can be of use.

http://sourceforge.net/projects/rdpman

JasonJ on October 2, 2006 11:40 AM

you could also logoff a remote TS user:

in cmd do:
quser /server:

logoff /server:

quite handy

cheers

felipe on February 2, 2007 05:51 AM

Thats cool !

mookDANG2008 on March 27, 2008 03:51 AM

Or you can do the following:

query session /server:servername

find the inactive user and then:

logoff usernumber /server:servername

Abject on April 13, 2008 04:49 PM







(hear it spoken)


(no HTML)




Content (c) 2008 Jeff Atwood. Logo image used with permission of the author. (c) 1993 Steven C. McConnell. All Rights Reserved.