Solved

Default User RunOnce after Sysprep in Windows 7

Posted on 2010-11-09
9
3,403 Views
Last Modified: 2012-05-10

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\Windows\CurrentVersion\Runonce post-sysprep with a sysprep file?

If it won't work what are my other options?
0
Comment
Question by:nicolashurtado
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
9 Comments
 
LVL 2

Expert Comment

by:Hossy
ID: 34093441
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.
0
 

Author Comment

by:nicolashurtado
ID: 34093460
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\Microsoft\Windows\CurrentVersion\Runonce" /v test.bat /t REG_SZ /d c:\test.bat /f
:: *** Unload Default User hive
reg unload "hku\Test"
0
 
LVL 2

Expert Comment

by:Hossy
ID: 34093505
Why go through the process of loading?

The default profile is always loaded at: HKU\.DEFAULT

So just do:

reg add "hku\.DEFAULT\Software\Microsoft\Windows\CurrentVersion\Runonce" /v test.bat /t REG_SZ /d c:\test.bat /f
0
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 

Author Comment

by:nicolashurtado
ID: 34093656
Last I checked there isn't a RunOnce under .default only Run and that's not going to work for my batch file
0
 
LVL 2

Expert Comment

by:Hossy
ID: 34093694
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.
0
 

Author Comment

by:nicolashurtado
ID: 34093758
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\Microsoft\Windows\CurrentVersion\Runonce and it worked?
0
 
LVL 2

Expert Comment

by:Hossy
ID: 34093784
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.... :-)
0
 

Accepted Solution

by:
nicolashurtado earned 0 total points
ID: 34191233
I ended up doing something i'm not sure was the BEST solution but it was A solution.

made all changes necessary then ran sysprep 1st with copy profile
then made changes to default user hive like i said

then ran syspep again without copy profile and sealed the image
0
 

Author Closing Comment

by:nicolashurtado
ID: 34221276
not 100% happy to have to run sysprep twice
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The recent Microsoft changes on update philosophy for Windows pre-10 and their impact on existing WSUS implementations.
When you try to extract and to view the contents of a Microsoft Update Standalone Package (MSU) for Windows Vista, you cannot extract the files from the MSU. Here we are going to explain how to extract those hotfix details without using any third pa…
This Micro Tutorial will give you a introduction in two parts how to utilize Windows Live Movie Maker to its maximum editing capability. This will be demonstrated using Windows Live Movie Maker on Windows 7 operating system.
The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…

724 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question