I came across this post on stackoverflow about logging off users remotely & found it quite handy at times. Thus thought of making a note of it on my blog.
Link: http://superuser.com/questions/650816/log-off-a-disconnected-user-remotely
To check connected users on server, command is:
C:\Users\sarangb>qwinsta /server:<server-name>
SESSIONNAME USERNAME ID STATE TYPE DEVICE
services 0 Disc
console 1 Conn
rdp-tcp#3 user1 3 Active rdpwd
user2 4 Disc
rdp-tcp#0 user3 5 Active rdpwd
rdp-tcp 65536 Listen
Note down the ID number from users you want to log off and then execute the following command:
C:\Users\sarangb>logoff 4 /server:<server-name>
If everything succeeded user with ID#4 should have been logged off.