Wednesday, January 17, 2007

Closing a terminal server sesison remotely.

Several times I get an error when I try to conenct to a server through remote desktop. That is due to the number of termional server sessions on the server has been exceeded. My solution was to go to the phisical machine, log in and disconnect one of the sessions. But what happens if the machine is not accessible phisically.

Well there are two commands that will do my live easier: qwinsta and rwinsta. With qwinsta you can query the opened sessions in a server:
qwinsta /server:[IP | name]

rdp-tcp 65536 Escuchar rdpwd
rdp-tcp#2 Administrator 2 Activo rdpwd
rdp-tcp#4 Administrator 1 Activo rdpwd

With rwinsta you can reset the connections. You have to specify the server and the session ID.
rwinsta /server:[IP | name] id

In the last example we could reset the session with: rwinsta /server:NEO 2
Where NEO is the name of the machine and '2' is the session id.

For more administration utilities you can visit this page about sysinternals.