Jump to content

Settings do not save on first complete boot


Recommended Posts

After a fresh XP install and the destop loads for the first time, I run a batch file to make some final registry tweaks, clean up shortcuts, and reboot one last time. Once this script is complete, I check that the shortcuts (Internet Explorer.lnk, Outlook Express.lnk, etc.) are deleted like they are supposed to then I check the registry to be sure the new settings are actually there. But after reboot, the shortcuts are back and the registry has reverted to the old settings again. :wacko:

If I run this script and reboot a second time, all the settings will stick. But they never stick after the first boot. This drove me crazy trying to find out why the right settings wouldn't stick. It wasn't until I started calling the script from HKCU..\RunOnce that I concluded that the registry simply was not saving the changes. Using Runonce, the script would run, reboot, then run AGAIN, and reboot. After the second reboot it would not run again. On first boot to desktop, Windows would delete the RunOnce entry like it was supposed to do, which I would verify with regedit every time. But when I reboot the, RunOnce entry would be there again. So -only on first complete boot and shutdown- windows would revert back to the same HKCU..\RunOnce setting, even after it ran it.

Observed on multiple installations of XP Pro OEM and XP Home OEM.

Somehow I think this behavior is by design from Microsoft, but I've searched for it and haven't find any documentation. The registry may be locked somehow on first boot (after GuiRunOnce) and not be editable until a second boot, but the shortcuts? Why would windows put those deleted shortcuts back after restart from desktop? Any other files copied on first complete boot seem to stay in their place.

As a workaround, I've stopped using RunOnce and I'm running my script (1stBoot.cmd) from %AllUsersProfile%\Start Menu\Programs\Startup that will set the computer to automaticly restart, delete itself from the %AllUsersProfile%..\Startup folder, and set a second script (2ndBoot.cmd) to run on next boot via %AllUsersProfile%..\Startup.

So after the first boot to desktop, 1stBoot.cmd will just set 2ndBoot.cmd to autorun and reboot. 2ndBoot.cmd does all the real work with registry settings and shortcuts on the second boot.

If anyone knows why the registry settings don't take on the first complete boot to desktop, (and why the shortcuts come back) please let me know.

Link to comment
Share on other sites


I use an AutoIt script on XP Pro, much like your CMD script to do the last tasks in the setup. The shortcuts for IE and some others are created late when you arrive to the desktop. My script removes these shortcuts and do other tasks after a 10 second sleep so Windows Setup has fully complete. Upon completion, tasks are done, the HKCU\...\RunOnce entry is automatically removed and I see no more of it. The shortcuts do not return as you seem to describe. Why HKCU\...\RunOnce runs again for you is beyond me unless your CMD file adds the entry in again perhaps.

:)

Link to comment
Share on other sites

I believe I found where I went wrong. I was using NTRegOpt during the runonceex phase. NTRegOpt will make an optimized copy of your registry and set windows to use it on reboot. If you make any changes to the registry after NTRegOpt optimizes the registry, but BEFORE the reboot, any more registry changes will be to the old registry and will not appear in the optimized registry after reboot. This is why NTRegOpt is designed to reboot automaticly after it finishes; I just use the -noreboot switch to prevent it. (This also explains my problem with running scripts from HKCU..\RunOnce) My workaround is just to set my script in \Start Menu\Programs\Startup restart the computer once more and everything imports after this restart. (Plus you get that "fresh booted without runonceex" feeling, if you know what I mean)

Edited by msdemich
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...