Remotely Log Users Off From CLI / PowerShell

KB ID 0001401


I’ve not had to do this since the days we got “The terminal server has exceeded the maximum number of allowed connections” errors. Now thankfully Windows Server tells us who is logged on so we can ‘ask politely’ before we boot them off!

Today though, my user session got all messed up, and I needed to kick ‘myself’ off remotely, (and have a fresh session.)


From a remote machine run the following command, to see who is logged on and, (more importantly get the session number for that user);

QUser /SERVER:{Hostname}
PowerShell Find out Who is logged on

Above the ID of ‘1’ denotes the session number, select the one that corresponds with the user you want to log off. Then issue the following command;

Logoff /SERVER:{Hostname} /{Session} /V
PowerShell Remote Log off a user

Job done, that was easy!

Related Articles, References, Credits, or External Links


Author: PeteLong

Share This Post On

Submit a Comment

Your email address will not be published. Required fields are marked *