nicolashurtado
asked on
Default User RunOnce after Sysprep in Windows 7
What I need to do is create an image and within that image I'd like to setup a script that will runonce for all new users after it's applied to the target PCs.
The problem is that I also need to do these changes before making the image. What I'm considering is to use the copyprofile setting in my sysprep answer file to propagate the Default User Profile first and then I'm considering to make a batch file to edit the registry. I can call this batch file in the sysprep file in Pass7. I'm not 100% sure that this will accomplish what I want though.
Has anyone had success with editing the Default User Hive @ %HIVE%\Software\Microsoft\
If it won't work what are my other options?
In all the images I've created, I've always written a series of BAT/REG files to modify the system as needed after sysprep. I've never tried RunOnce on the default user before, but it should be easy enough to try on a VM -- shouldn't take more than an hour. Remember to take snapshots so you can quickly try different scenarios.
ASKER
This is what I'm thinking.
::****** File:DefaultUserEdit.bat
:: ***** Configure Default User
:: *** Load Default User hive
reg load "hku\Test" "%USERPROFILE%\..\Default User\NTUSER.DAT"
:: *** Disable Desktop Cleanup
reg add "hku\Test\Software\Microso ft\Windows \CurrentVe rsion\Runo nce" /v test.bat /t REG_SZ /d c:\test.bat /f
:: *** Unload Default User hive
reg unload "hku\Test"
::****** File:DefaultUserEdit.bat
:: ***** Configure Default User
:: *** Load Default User hive
reg load "hku\Test" "%USERPROFILE%\..\Default User\NTUSER.DAT"
:: *** Disable Desktop Cleanup
reg add "hku\Test\Software\Microso
:: *** Unload Default User hive
reg unload "hku\Test"
Why go through the process of loading?
The default profile is always loaded at: HKU\.DEFAULT
So just do:
reg add "hku\.DEFAULT\Software\Mic rosoft\Win dows\Curre ntVersion\ Runonce" /v test.bat /t REG_SZ /d c:\test.bat /f
The default profile is always loaded at: HKU\.DEFAULT
So just do:
reg add "hku\.DEFAULT\Software\Mic
ASKER
Last I checked there isn't a RunOnce under .default only Run and that's not going to work for my batch file
No, there isn't, but you can create it.
The other option is to place it under Run and have your batch file delete itself under HKCU\...\Run once it's run successfully. Basically, that would cause it to run everytime until it succeeds.
The other option is to place it under Run and have your batch file delete itself under HKCU\...\Run once it's run successfully. Basically, that would cause it to run everytime until it succeeds.
ASKER
Well the situation calls for each user who logs into the pc to have certain settings enabled by default which means I can't delete the file itself.
Have you created hku\.DEFAULT\Software\Micr osoft\Wind ows\Curren tVersion\R unonce and it worked?
Have you created hku\.DEFAULT\Software\Micr
I didn't mean for the BAT to delete the BAT, I meant for the BAT to delete the BAT's Run entry under HKEY_CURRENT_USER\...\Run
I can't say with 100% certainty that I've done it before...I think I have, but I don't remember what I had for dinner last week so.... :-)
I can't say with 100% certainty that I've done it before...I think I have, but I don't remember what I had for dinner last week so.... :-)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
not 100% happy to have to run sysprep twice