Remotely Disconnect Users in Another Network Machine

Xybernetics Batch File Remotely Disconnect Users in Another Network MachineIf you use Terminal Service often, I am pretty sure you have been annoyed by user who does not log off from the remote session after they are done. Not logging off essentially, occupies a TS CAL (Terminal Service Client Access License) license. And as you know, a server class OS allows for only 2 TS CAL out-of-the-box. If you have a huge inventory of TS CAL licenses, then you are the lucky bunch. However, not everyone has that luxury.
The command outlined below show you how to remotely log off a user in another machine in the same network without having to take control of the computer.

1) Open the DOS command prompt as an administrator.
2) Check the session number with qwinsta command. Below is the command syntax.

QWINSTA /server:YOURCOMPUTERNAMEHERE

Note the session ID of the user that you want to remotely log off.

3) Use the logoff command shown below to disconnect user.

LOGOFF YOURSESSIONIDHERE /server:YOURCOMPUTERNAMEHERE


Example

The screen shot below shows what users are logged the target computer.

Xybernetics Batch File Remotely Disconnect Users in Another Network Machine

The DOS command (shown below) is executed in another machine (remotely) which is on the same network.
It shown the Session ID “rdp-tcp#26” is being disconnected.

Xybernetics Batch File Remotely Disconnect Users in Another Network Machine

If you get and error message of “Error 5 getting sessionnames Error [5]:Access is denied.”, it means that you are not the network domain administrator. Being just a local machine administrator will not work for this command.