This page was exported from phaq [ http://phaq.phunsites.net ]
Export date: Wed Apr 24 21:18:43 2024 / +0000 GMT
Darn it!
Imagine what happens when a Windows box, which is configured for remote administrative terminal mode only, is left with two zombie terminal sessions.

Maybe you are lucky, and Terminal Services Manager does the job for you. In theory, one might connect another host for management purposes.
In case your administrative credentials are different from the ones on the destination host, Terminal Services Manager might throw an insufficient permissions error at you.

So it was in my case, which I worked around like this:

First I opened up a command shell (Start - Run - cmd + OK), from which I ran this command:

C:\Documents and Settings\Administrator>net use o: \\192.168.13.205\c$ /user:Administrator

The password or user name is invalid for \\192.168.13.205c$.

Enter the password for 'Administrator' to connect to '192.168.13.205':

The command completed successfully.

This asked me for the credential of the remote system's Administrator
and connected it's shared C: drive to my system.
In fact, connecting the share isn't required, everything else works too, as long as you're prompted to enter the credentials for the remote systems.
In my experience, connecting a share proved to work out properly in most cases.

So afterwards, I ran this command to list the remote server's terminal sessions:

C:\Documents and Settings\Administrator>qwinsta /server:192.168.13.205
SESSIONNAME USERNAME ID STATE TYPE DEVICE
console 0 Conn wdcon
rdp-tcp 65536 Listen rdpwd
rdp-tcp#10 Administrator 2 Active rdpwd
rdp-tcp#16 Administrator 3 Active rdpwd

So, to kill any or all of these sessions, run this command:

C:\Documents and Settings\Administrator>rwinsta rdp-tcp#10 /server:192.168.13.205

It's also possible to kill a session by it's ID, which works like this:

C:\Documents and Settings\Administrator>rwinsta 3 /server:192.168.13.205

Let's check out if our zombie sessions are gone now:

C:\Documents and Settings\Administrator>qwinsta /server:192.168.13.205
SESSIONNAME USERNAME ID STATE TYPE DEVICE
console 0 Conn wdcon
rdp-tcp 65536 Listen rdpwd

So it looks good after all, the sessions are gone and I can reconnect the server using rdpclient as usual.

So let's disconnect the share now, as in fact it wasn't used for anything except to store the credential.

C:\Documents and Settings\Administrator>net use o: /delete
o: was deleted successfully.

By the way, if you don't want to encounter these hassles over and over again, terminal server can be configured to automatically terminatate stale/inactive sessions.
Find more about this in the Microsoft Knowledge Base.
Powered by [ Universal Post Manager ] plugin. HTML saving format developed by gVectors Team www.gVectors.com