How to Log Off Another User in Windows 10
Although the concept of multiple users sharing one device or one PC is getting rarer by the day, there are still cases when you have to share PCs and switch users fast. Sometimes you need to end a session for another user signed in to your computer. Here are a number of methods you can use.
The situation can be different when you need to end a user session. For example, someone just forgot to sign out from his or her user account, and left running apps and opened docs, so the remain in your computer's memory and consume its system resources. In this case, it could be useful to kick out the inactive session for the other user.
There are no third party tools required. This can be done using either Task Manager, Command Prompt or PowerShell.
To Log Off Another User in Windows 10,
- Open the Task Manager app.
- If it looks as follows, switch it to the full view using the "More details" link in the bottom right corner.
- Click on the Users tab.
- Right-click on a user account you want to log off.
- Select Sign off from the context menu.
You are done.
Alternatively, there are a couple of console tools we can use for the same purpose. Let's review them.
Log Off Another User from the Command Prompt
- Open an elevated command prompt.
- Type or copy-paste the following command:
query session
. This will list available user sessions. - Note the ID column value for the user you want to sign off.
- Now, execute the command
logoff <ID>
. For example,logoff 1
.
You are done.
Finally, you can use PowerShell, as follows.
Log Off Another User from with PowerShell
- Open PowerShell as Administrator.Tip: You can add "Open PowerShell As Administrator" context menu.
- Type or copy-paste the following command:
$sessionID = ((quser /server:'you computer name' | Where-Object { $_ -match 'user name to sign off' }) -split ' +')[2]
- Now, execute the command
logoff $sessionID
.
The PowerShell method is great when you know the exact user name. You can save it as a script and sign out other users with one click when needed.
That's it.
Related blog posts:
Support us
Winaero greatly relies on your support. You can help the site keep bringing you interesting and useful content and software by using these options:
To note, the logoff command is not available on Windows 10 Home editions.
None of these command line options work in the latest build at all. This article is just here to chew eyeballs, please fix it.
For someone looking for this answer. Use the below.
$Computername = Read-Host -Prompt ‘Enter Computername’
$Username = Read-Host -Prompt ‘Enter username’
$sessionID = ((quser /server:”$Computername” | Where-Object { $_ -match “$Username” }) -split ‘ +’)[3]
logoff /server:$Computername $sessionID