Solution: Windows Automatically Logs Off – Login Log Off Loop

Chiranjib, a regular member of Technize came up with another question today. This is what he asks:

The booting process of windows XP goes all right till the welcome screen then displays desktop wallpaper but with no icons just for 1 sec. Then it logs off the user and the displays the log on screen . Clicking the user name the the same thing occur again. Safe mode did not help to solve this. Then I tried to repair the OS but the system restarts when it says setup will complete in 34 min & setup resumes . Again the system restarts at the same stage.

I have already been searching for a solution to this problem. Actually the problem may be due to two common reasons. One is due to a virus attack and the other is due to corruption of a system file or registry.

Solution 1: (System Corruption)

If the system registry or boot files are corrupted, then a repair install of Windows is a good option. Repair install of Windows will replace corrupted files will the default files found in the Windows Installation Disk.
To do a repair install, boot with the Windows XP installation CD. When it says you want to setup Windows, press Enter. Then you have to agree to the License agreement by pressing F8. Then the process will search for existing installations of Windows. If it finds one, it’ll show you and ask whether you want to repair it or clean install a brand new Windows XP. Select to auto repair the existing Windows XP. It’ll go on with the repairing which is like installing new Windows. This will most likely solve the problem. If the problem persists, follow with the solution 2.

Solution 2: (Virus Attacks Likely)

The logon process is initiated by a file called userinit.exe which is located in System32 directory. If, by some means, it gets corrupted or it gets deleted, the user will not be able to logon. In this case you have to copy this file to your System32 directory again. To do this, boot with Windows installation CD or any other bootable CD (if you have userinit.exe with yourself) which gives access to the hard drive and copy the userinit.exe file back to system32.
The registry value of Userinit must also be directing to the correct path of userinit.exe. To see the Userinit value, go to the following registry key:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon
In the right hand pane, find Userinit and make sure its value is pointing to the correct userinit.exe path. In my case, the path is:
C:\WINDOWS\system32\userinit.exe
userinit registry value
If you don’t have a Windows Installation disk, just download the userinit.exe file from here:
[download id=”138″]
If you’re having any problem or solution regarding this, please let me know.


Posted

in

,

by

Comments

40 responses to “Solution: Windows Automatically Logs Off – Login Log Off Loop”

  1. rajdeep

    hi, geda kha

  2. Tom

    My computer was infected by W32.virut.CF, my norton scanned and found this and said it required a reboot to completely rid me of the virus. i then encountered the log in log off loop. i have tried safe mode, when using the recovery disk it couldn’t find the the userinit.exe file or wsaupdater.exe which have been suggested in previous forums. it apears it is not on the disk.
    Anyway, you have a link to the download of userinit.exe, so if i was to download it how would i copy it to my infected computer?
    I am running windows xp service pack 3
    Thanks in advance,
    Tom

    1. Sanix

      Tom you should copy the file to the infected computer by attaching its hard drive to another computer which is running fine. otherwise if you have a bootable usb drive, you can use it to copy the file. Or you can use any live Linux installation disk which runs from the CD ROM drive.

  3. Bailey

    USB is good idea, so is CD…but can’t get far enough in to even access either…NOW WHAT?

    1. Sanix

      Baily I think then you have to attach your hard drive to another system which is running properly and copy the file to the appropriate folder. If you find any other idea do tell me 🙂

  4. premanand

    I will say do as sanix told. Just attach your Harddisk in another computer access your files and copy them. And also after copying you can format the drive and connect it to your system and install a fresh copy of Xp init.

  5. premanand

    Just attach your Harddisk in another computer access your files and copy them. And also after copying you can format the drive and connect it to your system and install a fresh copy of Xp init.

  6. yavin

    can we access the registry of this HDD from the computer to which it is connected in order to correct userinit path?
    and i think solution 2 should be in place of solution 1.

  7. Ahmed Ehtesham Zaedi

    XPLogonLogoffLoopProblemSolution
    01. Using XP/server 2003 CD go to the REPAIR mode.
    02. In REPAIR mode
    a) Expand the “userinit.ex_” which will be under the CD:\i386 to the C:\WINDOWS\system32\userinit.exe. by giving the following command;
    “expand CD:\i386\userinit.ex_ C:\WINDOWS\system32\userinit.exe”
    b) reboot the computer.

  8. yousuff

    I have a similar problem, All the above solutions did not work Itried even copying userinit.exe from the Win CD – but no luck..
    Repair too did not work ,,, may be something else.. can you pllease do ssome thing.

  9. paul

    As of mu search for a solution I arrived here:
    OS: Win2003 Server SP2, on HP Proliant ML310G3
    Solution 1 – Repair could not do becaues the HDs are on RAID and I could not provide proper driver eventhough I tried all drivers from HP website. So Installation CD could not fidn the HD and load the OS.
    Solution 2 – Worked well which the mechine was infected by virus/spyware/malware. I also cleaned the virus/spyware/malware before doing this solution using UBCD4Win.
    This took me 2 days get around to this problem
    A very big thanks

  10. Jason

    Ahmed Ehtesham Zaedi
    May 21st, 2009 at 12:34 pm
    XPLogonLogoffLoopProblemSolution
    01. Using XP/server 2003 CD go to the REPAIR mode.
    02. In REPAIR mode
    a) Expand the “userinit.ex_” which will be under the CD:\i386 to the C:\WINDOWS\system32\userinit.exe. by giving the following command;
    “expand CD:\i386\userinit.ex_ C:\WINDOWS\system32\userinit.exe”
    b) reboot the computer.
    —————————–
    This solution worked for me, but i believe some people are most likely misunderstanding the instructions on what the OP is actually instructioning.
    Do this…
    01. Using XP/server 2003 CD go to the REPAIR mode.
    02. In REPAIR mode
    03. Map to your CD drive. In most cases it will be your D:\
    a) Type d:\ to access the CD/DVD drive.
    b) Type cd\i386
    c: Type copy userinit.ex_ C:\WINDOWS\system32\userinit.exe
    b) reboot the computer.
    This worked like a charm for me and I was able to login as normal into the computer. I am now doing a full Norton scan. Are there any other steps that need to be done to fully fix this issue from happening again?

  11. sunder

    userint path was wrong it worked after i set this path..
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon

  12. netsky32

    Thanks for the solution bro. It is works.
    For the question:
    “can we access the registry of this HDD from the computer to which it is connected in order to correct userinit path?”
    – Yes you can. First get the HDD and attach to other PC. Run shiftlogin batch programming to replace sethc.exe with cmd.exe to the HDD Windows Directory. After that, put the HDD back to the infected PC. Start PC, and during logon, press shift key 5 times, command prompt will appear. Then just run regedit and fix the value.
    That is how i solve my problem.

  13. netsky32

    forgot to mention, you can get the shiftlogin program at my blogspot.

  14. Will3265

    Thanks for your help that worked perfectly for me.
    i did it a little differently and this will work for any xp machine that is joined to a domain.
    Open windows explorer and type in “\\brokenworkstation\C$”
    Replace “brokenworkstation” with either the name or the IP address of the affected machine.
    From there you have complete access to the file system so you can navigate to c:\windows\system32\ and copy userinit.exe there.
    Note:- you must be an administrator to access the C$ share on the affected machine.
    Thanks again Sanix

  15. sanjay Tripathi

    Thanks for the solution. My problem is solved.

  16. nick002gem

    thanks thanks thanks thanks a lottttttttttt.
    this site rocks.
    u people saved my life.
    microsoft help page is @@@@@@@ page & so there search engine which is more @@@@@@@ atleast it should point me to solution in there helping site first.
    google rocks(coz of which i got this page).
    worked for me.
    now am back to business.
    what i felt,came straightaway on my keyboard.

    1. Sanix

      nick002gem, it’s nice to see your excitment 🙂 . I’m glad the solution worked for you. Keep visiting.

  17. Shawn

    How can you edit the registry AFTER expanding the userinit.exe file?
    If I replace the userinit.exe file, and the PC still won’t start, is it possible to then edit the registry using the Repair Console?
    Thanks in advance,
    Shawn

  18. Jon

    Every time I try this.
    “01. Using XP/server 2003 CD go to the REPAIR mode.
    02. In REPAIR mode
    a) Expand the “userinit.ex_” which will be under the CD:\i386 to the C:\WINDOWS\system32\userinit.exe. by giving the following command;
    “expand CD:\i386\userinit.ex_ C:\WINDOWS\system32\userinit.exe”
    b) reboot the computer.”
    It says that The file name, directory name, or volume label syntax is incorrect. Any ideas what this means?
    I’ve also tried copying the Userinit.exe into the Wsaupdater, but I always get that the specified file cannot be located.
    Any help is gladly appreciated.

  19. Geordie

    I just fixed a lenovo x61 laptop. Whenever the user booted to the desktop the machine would shutdown (like a normal everyday shutdown) and reboot.
    I found that Windows Defender was the culprit, somehow. Booted into safe mode, ran msconfig and turned it off from the startup tab. Works great now.
    -That’s my experience, individual results may vary =)
    -G

  20. Nando in Miami

    Just fix the log on log off loop problem. Screw what you have read..sounds like a friggen mission!
    Heres what you do, You will have to remove the hard drive from your PC and connect it to another working PC via an hard drive external enclosure with usb (I got mine for less that $20 at CompUsa, btw they come in handy in the future). Download the Userinit File above in this website and unzip it and drag the file to your desktop. Download Malwarebytes from download.com and install it on your working PC. Connect the bad hard drive to the working computer via the usb cable. Open Malwarebytes and select Perform Full Scan and select the drive where the Usb HD is connected (mine is e:\ )Select Start Scan and let it scan, once complete, remove the infected files and restart the PC. Once the HD shows up your screen, open to view the files inside. Open the file named Windows then system32. Drag the userinit file that you put on your desktop into the system32 folder close and shut down. Now take the HD out of the enclosure and put it back in to PC that was messed up and start it up. You should have no more log in loop.
    Let me know if this worked for you.

  21. Dare

    thanks. My system is working now but immediately after I got the keyboard error. Now my keboard is not working. if i press any key, the system hangs. I have tried reinstalling driver and all even repaiing the operating system but it is not working. Please help.n@Jason

  22. Nav

    Hi,
    I have Lenovo T500 XP with Mcafee for anti virus. It gave me a New Win32 virus alert and then asked me to reboot. After which i have the issue being discussed here. Problem is lenovo is allowing me to do only its Rescue and Recovery which talks about fixing corrupted Iexplorer.exe and userinit.exe(missing). Now i am trying to take a backup of files through lenove rescue and recovery before trying your option but its not showing my USB hard drive which i am connecting for backup purpose. Can you please help me fix this.
    Thanks,
    Naveen

  23. kris

    I have spent some time on this. Not continually because I decided to give it “some time” and come back to it a few days later with a new look at it. My problems started when my server lost power (win2k3 ent version) and when it came back up it was wigging out (things acting up and not responding to inputs) so I hard powered it down. Thats where the real problem started. Once I booted it again I got blue screens and it went into the constant reboot loop. So obviously some problems there, I tried safe mode, command promp, last known good, and every other option available and nothing worked. I removed all unnessisary hardware and rebooted and again tried all options, still the non stop loop. Well I decided since I was running the system with a mirror controlled through the OS I would try to boot from the secondary drive thinking the mirror had not gotten whatever problem the primary drive had since windows didnt have time to do both. Well with that drive I got the login logoff loop. I thought it may be because it was the secondary drive (hardware and mapping wise) so I put both drives into another server with nearly exact hardware and booted them both as secondary. Mirrored the orriginal with the data from the mirror (1 was mirror of 0 so I mirrored 0 with 1). Same problem. I tried all the recovery stuff with no prevail because to do the mirroring with win2ks ent server you have the make the drives dynamic, thus not readable through DOS recovery bit. They were showing up as unknown when i did a drive scan. SO after a number of different things I started looking online and found this thread, scanned the drives with the other server, replaced the userinit.exe file with the one downloaded from here and all with still no prevail. I did some other messing round with the drives, converting from basic to dynamic and then went back to the orriginal that was still dynamic and booted with a newly burned copy of the server install disk, went through the install process untill I reached the point where it would scan the drive, low and behold it not only found and recognized the drive but it noticed the install (at that point recognised as E:) and gave me the option to do the repair. I did that process with a few minute errors (file copy and non normal drivers) and also initiated a drive scan on reboot. Well it did the repair, deleting the system files and reinstalling them, had to enter the serial key again (i thought that was odd) and then it rebooted after some time of doing its thing. On boot it did the entire scan including phisical marking bad sectors if they were there ( i did not babysit it so I am not sure if it did find any) then it booted to the login prompt. I logged in with my admin account without the loop, things worked, FINALLY. The system has been offline for a little over a week since I have been so busy with other things and now I am back online. I did learn a lot from the experience (aka this thread and that login related file and the like) and that is why I did it orriginally. Honestly it would have been a lot easier to just reinstall (less time as well) yet by doing so I would not have gained the experience of this problem and troubleshooting it which in reality is why I chose to grind through it. I still have a few problems with the server related to drivers and a few system files but I expect device uninstall and reinstall along with the drives and doing a system update shall clean that up. I wish anyone with the same problem the best of luck and dont give up as you will certainly feel good once you win of the comp. Thanks to everyone else who contributed to the thread, its all of us who did so that makes it more easy to find experience from others who have had the same problem and reported it.

  24. Kevin Carmona

    Another simple method is the change the path manually using remote registry edit and going to:
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon
    The value should say:
    C:WINDOWS\system32\userinit.exe
    If it doesn’t double-click the value and change it.
    DONE!!! Problem fixed. Just install a new virus protection and spyware and you’re good to go.

  25. -kEirA-

    wait listen to me..
    i have another alternate option for those with problems with the Log in then Log off process..
    a week ago i encountered the same problem but somthing slipped out of my mind..
    This process is for those who r like me, am not a Computer Wiz but i do
    know some basics of computer..so Logically saying, if u have any windows XP OS ,u can do it..
    here it goes..
    1. go into ur bios settings and choose ur cd/dvd drive as 1st boot device..
    2. enter it, as if ur going to reformat or format ur computer..a blue screen appears..
    3. press F8 to accept agreement then if repair function is available, try it..but if u already do, then skip to it.
    4. try to create a partition of ur hard drive, enough space to install a new windows XP OS into it(approx 1.5GB)
    5.Install windows XP os(any windows xp OS pro,home,etc)
    6. install it on ur partitioned space(the one u made earlier)
    7. complete the installation
    8. after completing the instalation, u should see ur drive C:
    9.Take note, u could install anti virus software on this OS(the one u just installed) u could scan ur Drive C:, u may not, what am trying to say is, u have the option to scan it or not..
    10. whether or not u ran a virus scan on it, go here:
    X:\WINDOWS\system32
    Copy userinit.exe
    then go to:
    C:\WINDOWS\system32
    paste ur copied userinit.exe in this folder
    where “X” is the the drive u installed ur secondary OS
    and C: is ur main drive(the one with the problem of login-logoff)
    11. reboot ur PC and check whether it still has a problem(logoff immediatelt after logging in)
    well, this is for those who cant , or doesn’t have time to access BartPE’s
    and UBCD
    it worked for me, i just copied userinit.exe into my local drive then after that i removed that partition that i made..
    Q: why didn’t i just copied 1 from my windows OS CD?
    A: i cant access my accounts, even in safe mode
    that’s all i can help..
    am doing this because i swore that i will participate in anti Malware’s Group
    i just can’t understand why some people doing irritating things like this..
    thx..
    – kEirA –

  26. edmar

    hello to you:
    i have the same problem. when i log on windows, it automatically logs off.. I tried repair using windows xp sp2 installation disk. When it restarts and then says 39 minutes to complete installation, there is a fatal error message prompt. I clicked to view the log error but there’s nothing written in there, just a blank white page window. Then i clicked again to close the log window, the system restarts. so it means, using repair didn’t work for my system.
    i tried to copy the userinit from the cd. I typed: copy e:\i386\userinit c:\windows\system32\ but when i hit enter it says that it cannot find the specified file.
    please help me solve this problem so that i can log on to windows again normally..
    thanks!
    God bless..

  27. – kEirA –

    hey edmar,
    i knew that repairing the system wont work, that’s why i told in my
    comment how to repair it that it might not work, or if it works, u will still have the same problem coz eventhough userinit.exe is fixed, u’ll still encounter that coz of the malware or virus or some sort of what is still in ur PC..
    and, by the way, i think there’s no other way to get rid of that, since i have tried almost all of the anti viruses and anti malwares available..i even tried to contact a professional for my problem, but still, he failed to repair my PC..
    he offered me to reformat my system..but i rejected it coz he’s charging me $50 for that silly reformat which i can do myself ..
    by the way, just by simply copying it in the CD wont make it work..
    as far as i can remember..the file format of userinit in the CD is like this
    “userinit.ex_”(without the quotations)so it’s file format is a *.ex_” file
    so try to copy from a friend who has a windows XP OS..that might be a little easier..
    the “FIX” that i presented above is just a little way to give urself some time to copy or make back up for those important files in ur PC..
    i think there’s no other repair for this problm except for reformatting ur PC..
    i think that some people hu has d same problem as ours, cant reformat their PC’s, cause ive’d read that most of them, haven’t or doesn’t have made back up for their files..
    so i think, u’ll have to either reformat it or let it stay that way..
    and by the way, the fix that i presented above is effective, after doing those things, i made immediate back up for my files, then reformated my PC.
    why?cause i felt that the thing that made my PC go like that, is still in my PC(since those virus detectors and anti malware programs that ive’d used didn’t find a thing)
    so, that’s all.. am doing this because i wanted to help others..
    For someone out there that has the same solution as i am, but posted it ages ago in a different BLOG or thread, or something..
    am sorry but am not plagarizing ur work or solution..the solution i made just popped out of my mind when i was reading something in the net.
    Thx in advance
    – kEirA –

  28. Shawn

    The computer isn’t booting from the disc! It just keeps booting normally. I don’t know what to do to stop this log on loop virus. Please help.  Drewcarey_69@yahoo.com

  29. Shawn

    ok. I read back. I have the computer booting from the disc but the copy userinit.exe thing isn’t working. How can I copy what I still have on the computer before reformatting if I have to?  Thanks. Shawn  Drewcarey_69@yahoo.com

  30. Wasi

    hey thanks it worked! it works on windows 7 too :). there is a bit of extra code on the reg edit, pointing to another file (some virus file by the looks of it) along with the userinit.exe.
    great help!

  31. Shaun vW

    This forum seems to have the most info on this problem, so thanks.
    I have picked up this same problem but using Windows 7 Professional.
    I have 2 profiles on my computer, one for work, one for home. My home profile logs in fine, my work one just does the logon/logoff loop. (I am actually using this home profile now to post!).
    So I checked the registry, and it points to the correct file. Someone says to get it from another computer that already logs in fine, and to copy it over. However, being ignorant on this, will I then still be able to logon using my same credentials? Won’t it then be wanting the credentials that the other computer expects to logon?
    And do both profiles use the same userinit.exe?
    I have also tried following some of the other advice, i.e. I did a safe mode logon (which worked fine!), then did a system restore to a previous state, but when I tried to logon, it again went into the loop. In hindsight, I should probably have checked for viruses before doing a system restore, but I just didn’t know, and now in all likelihood, the previous restore has also been infected.
    I am running a scan now using Symantic EP (latest version), it has picked up a tracking cookie, which it has deleted.
    Will any threat removed in my home profile also remove it from my work profile?
    Not sure how to continue, as the posts mostly deal with XP.

  32. Sanix

    @Shaun vW
    If you can logon to your system from another profile and have the Windows 7 DVD, then you should run the system file checker. In your Windows 7, go to Start Menu, search for cmd, right click it and run as administrator. Issue the following command:
    sfc /scannow
    This will check all your system files. It may take a while for it to complete checking. Hopefully it’ll replace the corrupted file. Kindly let me know of the results.

  33. gaurav

    thanks bro!!!!

  34. jose

    plz help how can i romoved the virus if i dont have a cd or windows xp cd plz help i cant enter

  35. GOPAL

    Iam working Toll Plaza having 12 booth ,on that 12 systems windows xp installed.While doing operation the system automatically gets logoff.Is this due to any power fluctuation.This is happening in staggermannerlike one by one gets logoff.Kindly suggest meforthe same.

  36. pawan

    this is very usefull … artical .. :)))))) thanks a lot

  37. winny

    I have log in then log off automatically problem with my Windows XP. I tried to fix using windows XP setup CD. After i choose recovery console, the system ask for administrator password. I write the correct password i usually use to log in but it said that the password invalid.
    Please help me fix this.