I have an old P4 running Windows 7 that I use to share some file from USB-attached disk drives and these days it happens that this box is periodically crashing and a BSOD is displayed. Due to the lack of time I am not willing to migrate these shares to another computer because a lot of configuration work would be necessary.
Thinking of a DIMM problem, I ran Memtest86+ from a USB disk (this is the best tool I've found so far for detecting RAM hardware errors, also because it has an auto-installer which does all the job of formatting a USB key, making it bootable and copying the memory diagnostic exe on it in one step) but, though I let it run for 3 days and made 16 passes, it didn't find any problem. I decided then to make an attempts with the new Windows Memory Diagnostic tool (which you can find in the 'Administrative Tools' menu) but it didn't detect any fault either.
So I gave up the idea of repairing the hardware and decided to implement a mechanism to auto-logon, then add a batch script to the 'Startup' folder which runs the sharing applications and lock the workstation straight after. So each time my workstation makes a BSOD all the applications I need are automagically restarted.
The first step is to enable auto-logon on Windows 7:
- run 'control userpasswords2'
- uncheck 'Users must enter a user name and password to use this computer'
- click OK
- an 'Automatically Log On' dialog box will appear
- enter the username you want to use for auto-logon and its password
- click OK
That's all. Auto-logon is now set.
The second step is to add a startup scripts which launches your applications then lock your Windows workstation. To do so:
- browse to %appdata%\Microsoft\Windows\Start Menu\Programs\Startup with Windows Explorer
- create a new batch file (.bat) in there
- add the names of your executables one per line this way:
- start application1.exe
- start application2.exe
- start applicationn.exe
- at the end add this command to lock your workstation: 'rundll32.exe user32.dll, LockWorkStation'
- save your batch file
This way your computer will boot up and log on to Windows, then start your applications and lock itself. No action needed at all. At least in theory. In fact in my case my good old P4 didn't want to boot ans stayed stuck at detecting the attached USB drives. To solve this I went into the BIOS and disabled the USB Legacy Support. Disabling this option makes your BIOS not to try to initialize the USB disks on start-up, but leaves that task to Windows, which is kind of a USB-aware OS.
Three important notes now:
1) Configuring automatic login stores the user’s password in the registry (under HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\DefaultPassword) unencrypted which may represent a security weakness for critical systems.
2) Disabling USB Legacy Support will make your USB keyboard unavailable, so always have a PS/2 keyboard at hand.
3) Advanced users can tweak Windows 7 directly from the registry by modifying the ‘AutoAdminLogin’ value to ‘0′ to disable automatic login and ’1′ to enable it. The key is found in HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon.
I hope this little post will help somebody. I am just sharing my experience on the field... so do not hesitate to comment or post your questions!