Q: How can I log off users that are connected to my Windows Vista or Windows XP machine locally or remotely?
A: You can use the Windows Task Manager to forcibly disconnect locally or remotely connected users. To access the Task Manager, press CTRL+SHIFT+ESC or right-click the taskbar and select Task Manager. Then select the Task Manager’s Users tab to see all the users that are connected locally or remotely to your machine. Figure 1 shows a XP machine's Users tab. Remotely connected users have a machine name (e.g., JAN-PC for user Joe in Figure 1) in the Client Name column. This column is empty for locally connected users.
Forcibly disconnecting a local or remote user requires administrative privileges. If you don't have sufficient privileges, the Logoff and Disconnect buttons will be grayed out in the Task Manager. In XP, you can use the RunAs utility to switch to the security context of an Administrator account. To easily elevate your privileges in Vista, click the Task Manager’s Process tab, and then click the Show processes from all users button. Doing so will open a User Account Control (UAC) elevation prompt for the Task Manager. After you've approved the elevation or provided Administrator-level credentials, UAC will change the Task Manager to the security context of an Administrator account.
Once you have sufficient privileges, you can use the Task Manager’s Users tab to disconnect or log off a user. To do so, select the user and click the Logoff or Disconnect buttons. After this action has completed successfully, Task Manager will no longer show the selected user because he or she has been logged off or disconnected.
To log off or disconnect a user from the command prompt, use the logoff.exe command-line utility. To use this tool, you must know the session ID of the user whose session you want to disconnect or log off. You can find the session ID in the ID column of the Task Manager’s Users tab. However, keep in mind that when you forcibly disconnect a user, the user might lose data, so please use remote logoff with extreme care.