How to Fix the Automatic Log off of Windows while Logging in

Recently I came across a problem of Windows automatically logging off. This happened when I was logging into Windows. Windows showed that it was applying settings, saving settings and logged off automatically without even logging in. This is really annoying and frustrating when you are in need of your computer for an important work.
The reason for this problem…
It’s the result of a Virus or a Trojan which corrupts the registry key holding the value of the files which are executed while logging in to windows. The other possibility is, the registry key getting replaced with some incorrect value.
The fix for the problem…

1. You need to connect the infected computer to a network. Make sure that there is one computer in the network which doesn’t suffer from this problem. Now, switch on both of the computers, i.e. the infected and the working computer.

2. From the working computer, Go to Start> Run, type regedit.exe and hit enter. This will launch the registry editor.

3. Go to File> Connect Network Registry, by using this infected computer’s name or IP address.

4. Locate the following entry:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\

5. In this entry there is a key named userinit, double click on the key and set its value to “C:\WINDOWS\System32\userinit.exe,”
If the problem still persists then you need to run a repair setup. Check out for detailed instructions on running a repair setup over here.



16 comments for “How to Fix the Automatic Log off of Windows while Logging in”

  • Debbie

    This solution worked great for me! I could not get logged in without getting logged right back off. When I tried to log in in safe mode, I was told the administrator password was incorrect, so I couldn’t do a repair. Thank you for posting this information.

  • Tim

    How do you connect the infected computer to a network if you can’t log on to it?

  • John

    Thanks for these instructions.

  • For Windows 2003 server it’s not working.

    Anyway thanks for the tip.

  • Praveen

    Hi, It got into this problem because of a spyware called Internet Security 2010. I had very difficult time to get to the registry to do the change. Once I had access to registry, i changed it easily. One more observation: In the same Winlogon key, another entry called “Shell” was also altered i.e it got updated to a value as “explorer.exe logon.exe” which should be just “explorer.exe”.

    One quick question, how can we read/modify registry when we are not able to login to machine. i.e anyway to directly read the registry values by connectiong HDD to another machine?


  • C.Schaad


    Thanks for this post, it worked like a charm. I did not know you could connect to registry through network.

    Previously I tried some other solution (trying to copy winlogon to another fileame which was supposively targeted by registry after spyware) without success.

    Anyway thanks again, I was really afraid I would end up using the XP cd repair option.


  • You’re welcome Schaad.

  • John L

    This looks like the solution I need for the problem caused by the Internet Security 2010 virus!

    I was able to get into the registry editor for the infected computer over the network, but when I try to open HKEY_LOCAL_MACHINE it tells me that I do not have permission. Does anyone know if I am doing something wrong here?

  • ron sikander

    My 3 computer was affected by trojan virus. After running virus scan I have a serious login problem.

    Thanks to the weblink advice i was able to fixed the problem.

  • ron sikander

    After affected by the virus i did not have access to any of these computer by remote login to modify regedit.

    How I fixed the login?

    I have a ERD COMMANDER cd that allows any windows administration password to modify. Works like a magic.

    I reboot all the 3 xp computer one by one with the cd. It automatically goes to a special xp interface and allow me to go the regedit location and modify the specified path.

  • Ed Paulsen

    On my system, my userinit was actually missing. I added with the C:\WINDOWS\System32\userinit.exe and it solve my problem too.

    Thanks for the post!

  • Joel

    for thus who did not solve the problems, even with this, like me; i just modified the string C:\WINDOWS\System32\userinit.exe for only: userinit.exe , that’s solved my problem.

  • Khaled

    how i can inter to the infected pc registry not to solve the proplem

  • Phyllis

    I was frustrated needing a quick solution and this worked very well off a windows Vista PC. Thank you!

  • You’re welcome 🙂

  • K_builder07

     WHY I cant DO the step 3? there will be post I need to open the infected PC BUT the PC infected is OPEN

web analytics