O'Reilly Hacks
oreilly.comO'Reilly NetworkSafari BookshelfConferences Sign In/My Account | View Cart   
Book List Learning Lab PDFs O'Reilly Gear Newsletters Press Room Jobs  


Resetting a Terminal Service Session Remotely when the licenses are used up
This article will teach you how to reset a terminal server session when the maximum licenses are used up.

Contributed by:
Lawrence Abrams
[01/13/04 | Discuss (3) | Link to this hack]

In my job we tend to get alot of users who have Windows 2000 boxes running terminal services in administration mode. This allows the client to have two active connections at one time to the box. If there ar 2 connections, they will no longer be allowed to connect due to a license limit.

We tend to get calls often from our clients asking us to reset their terminal service connections for them. As the collocation center is not close by, I have found a way to do this remotely.

Using a program called Xcmd, and as long as you know an administrator user/password, it is possible to create a reverse command shell on the remote server, that appears on your screen.

You can download Xcmd from, http://www.codeguru.com/network/xCmd.html.

You would then use it as such:

xcmd \\serverIP /user:administrator /pwd:password cmd

This will pop up a console window on your computer of the remote machine. From there you can run any dos command on the remote machine and therefore can manipulate the terminal service sessions.

Some commands are: tscon,tsdiscon,tskill,query session, reset

Hope this saves some of you trips to your servers.


Some notes:

  • Yes i can change the disconnect time out so that this does not happen, but I have clients that run programs in the session while disconnected so this does not work.

  • Yes this only works if you know the username and password of an administrator account.

  • Yes there are alot more uses of this command. Play around, its an excellent program. There is another program called psexec that does the same thing.

See also: Windows 2000
Terminal Services

O'Reilly Home | Privacy Policy

© 2007 O'Reilly Media, Inc.
Website: | Customer Service: | Book issues:

All trademarks and registered trademarks appearing on oreilly.com are the property of their respective owners.