Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Default User RunOnce after Sysprep in Windows 7

Posted on 2010-11-09
9
Medium Priority
?
3,550 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

When you try to share a printer , you may receive one of the following error messages. Error message when you use the Add Printer Wizard to share a printer: Windows could not share your printer. Operation could not be completed (Error 0x000006…
IF you are either unfamiliar with rootkits, or want to know more about them, read on ....
This Micro Tutorial will teach you how to change your appearance and customize your Windows 7 interface to your unique preference. This will be demonstrated using Windows 7 operating system.
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

604 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