How to force user log off
I’m the administrator of Windows Server 2008 / Domain. We have Several users and workstations connected to this domain. I received a message from my boss to disable account of one of our user who is already logged in at the moment. I tried doing it normally as we disable the accounts from domain but it is not working for him. As that particular user is already logged in and
even the screen saver is on, he is still able to log in back.
Can anybody please tell me how can I force him to log off and how can I disable his account immediately in this situation? Help appreciated.
Re: How to force user log off
Yes, it is possible to log off any user in this situation. You can do it easily by remote control. Listing 8.24 contains a script that shuts down a computer. To carry out this task, the script must perform the following steps:
- Create a constant named SHUTDOWN and set the value to 1. This constant specifies that the computer should be shut down.
- Create a variable to specify the computer name.
- In Listing 8.24, the computer name is set to "." which will result in the local computer being shut down. To shut down a remote computer, simply set the variable to the appropriate computer name.
- Use a GetObject call to connect to the WMI namespace root\cimv2, and set the impersonation level to "impersonate."
- Use to the ExecQuery method to return a collection consisting of all instances of the Win32_OperatingSystem class.
- The Shutdown privilege must be specified as part of the GetObject moniker. If it is not, the script will fail and the computer will not be shut down. The Shutdown privilege is required to shut down a computer by using WMI. However, including the privilege within the moniker does not ensure that the script will succeed. In addition to inclusion of the privilege within the moniker, the user under whose credentials the script is running must also have permission to shut down the computer.
- For each operating system in the collection, use the Win32Shutdown method, specifying the constant SHUTDOWN (with the value 1) for the method parameter.
To shut down, but not power off, the computer, use the value 1 as the method parameter. Other values will result in other actions. For example, the value 0 will log the user off but will not shut down the computer.
For more information on the same, check this: http://technet.microsoft.com/library/ee156545.aspx
RE: How to force user log off
Hello Fedlix. I have bit confusion from your post. You said "User is logged in and even the screen saver is on." What you actually mean by that? Is it the user is actually logged out or is the screen saver just coming on?
RE: How to force user log off
Yes, the user is still logged in, whenever i try forcing loggin him off the screen saver came out. And he is still able to log in.
RE: How to force user log off
I dont think is it possible to force log off to a user from domain controller. In case the account is disabled he wont be able to log on to another machine. Apart from technical method, why dont you just go there and log him off physically from his system as you go order from your and his boss.
Re: How to force user log off
Hello Fedlix.
Just give a try to this:
shutdown -r -m \\pc001
this will reboot pc001 hence get the user out of the pc. Thats so simple.
Re: How to force user log off
If it is remote login, then it is possible.
We can go to the server command promt, 'query session' and logoff the user