Solved

Default User RunOnce after Sysprep in Windows 7

Posted on 2010-11-09
9
3,177 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
  • 5
  • 4
9 Comments
 
LVL 2

Expert Comment

by:Hossy
Comment Utility
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
Comment Utility
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
Comment Utility
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
 

Author Comment

by:nicolashurtado
Comment Utility
Last I checked there isn't a RunOnce under .default only Run and that's not going to work for my batch file
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 2

Expert Comment

by:Hossy
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
not 100% happy to have to run sysprep twice
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Image capture and Deploy method is consist on two phases. In our first phase we capture the image of windows from the PC in which Windows and others softwares are already installed. In second phase we deploy the created image on new PC in which we…
I found out last night windows update has a problem regarding 4 latest updates that fail.  The way to get all 4 them installed is install sp1 first and restart then one by one with a resart in between as they fail every time if all the four updates …
This Micro Tutorial will teach you the basics of configuring your computer to improve its speed. It will also teach you how to disable programs that are running in the background simultaneously. This will be demonstrated using Windows 7 operating…
The Task Scheduler is a powerful tool that is built into Windows. It allows you to schedule tasks (actions) on a recurring basis, such as hourly, daily, weekly, monthly, at log on, at startup, on idle, etc. This video Micro Tutorial is a brief intro…

772 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now