Pakcik Google

only search Ask MrJ

Friday 10 June 2011

Logoff user remote session using CMD

Using CMD to kick user not properly logoff in remote session.


This command to list out the user. Have 2 command :

1 - quser /SERVER : [server name]

2 - qwinsta /SERVER : [server name]


This command to kick the user :

1 - logoff  /SERVER : [server name] [session id]




Example :

C:\x>quser /SERVER:xxxx-xxxSxAPP
 USERNAME              SESSIONNAME        ID  STATE   IDLE TIME  LOGON TIME
 root                                console                      0    Active                     .     5/21/2011 5:09 AM
 anuar                                                                 1   Disc                    none  6/7/2011 9:45 AM
 izuan                            rdp-tcp#42                   2  Active                     59  6/9/2011 10:47AM

C:\x>qwinsta /SERVER:xxxx-xxxSxAPP
 USERNAME              SESSIONNAME        ID  STATE   IDLE TIME  LOGON TIME
 root                                console                       0    Active                     .     5/21/2011 5:09 AM
 anxxxxr                                                                1   Disc                    none  6/7/2011 9:45 AM
 izxxx                            rdp-tcp#42                     2  Active                     59  6/9/2011 10:47AM



C:\Users\azam>logoff
/SERVER:xxxx-xxxSxAPP  1

4 comments:

  1. Do you know the command to logoff particular user (Not session) with logoff command?
    Like logoff /server:xxxx username

    ReplyDelete
  2. Do you know the command to logoff particular user (Not session)?
    Like logoff /server:xxxx username
    My requirement is that i want to logoff a particular user and not the session. Because username is unique for all the servers but session ID

    vary for the same user in different different servers. So for example i am making a batch file to logoff the same user from 100 servers

    simultaneously, i have to put 100 different session IDs or session names for all the servers, but if i know the command to logoff the same

    user from 100 different servers then it will be easier for me to make a batch file and log hi

    ReplyDelete
  3. use Terminal Services Manager. You Can logoff by user.

    ReplyDelete
  4. I think Zia rahmani's question is not answered..He is looking for a particular user to be logged Off from multiple servers.

    Using Terminal services manager is a tedious task if servers are more.

    And in few cases, we cannot connect to Terminal services manager remotely from another server.

    ReplyDelete