Posts Tagged ‘log off another user from cmd’

3 Ways to Log off Another User in Windows 10

October 14th, 2019 by Admin

How do I sign out other user accounts without restarting the computer? When someone forgets to log out of a public or shared PC, their account still consumes RAM in the background. To free up the resources being used by other logged-in accounts, you can log them off using Task Manager, Command Prompt and PowerShell.

Method 1: Log Off Another User Using Task Manager

Press the Ctrl + Shift + Esc keyboard shortcut to launch Task Manager. Go to the Users tab, it will list all users that are currently signed in to your system. Right-click on the user you want to log off and select the Sign off option.

You will get a warning that says the user’s unsaved data might be lost. Click on Sign out user when you need to proceed.

Method 2: Log Off Another User Using Command Prompt

Open the Command Prompt with administrative rights, run the query session command to see all users currently logged into the computer. Take note of the session ID of the user you want to sign out.

Next, run the following command to log off your desired account by specifying the session ID.
logoff ID

This method doesn’t give you any alert or confirmation that the user you’re signing out will lose unsaved work.

Method 3: Log Off Another User Using PowerShell

Open Windows PowerShell with administrative rights, and type the following commands. Replace “Server01” with your computer’s name and substitute “pcunlocker” with the name of the account you want to log out.
$server = 'Server01'
$username = 'pcunlocker'
$sessionId = ((quser /server:$server | Where-Object { $_ -match $userName }) -split ' +')[2]
logoff $sessionId /server:$server

Once logged off, the user account is no longer listed in Task Manager. Signing a user out this way has the same risk of losing all unsaved data as the above method.