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
Solved

Default User RunOnce after Sysprep in Windows 7

Posted on 2010-11-09
9
3,292 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
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
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 

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

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

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

Hi Friends, These registry tweaks will help you optimizing your Windows 7 system for any VDI. This will improve the machine performanance and can be used on normal systems also. These are few registry tweaks which will add value by enhancing the …
When you start your Windows 10 PC and got an "Operating system not found" error or just saw  "Auto repair for startup" or a blinking cursor with black screen. A loop for Auto repair will start but fix nothing.  You will be panic as there are no back…
This Micro Tutorial will teach you how to the overview of Microsoft Security Essentials. This is a free anti-virus software that guards your PC against viruses, spyware, worms, and other malicious software. This will be demonstrated using Windows…
This Micro Tutorial will go in depth within Systems and Security in Windows 7 and will go into detail regarding Action Center, Windows Firewall, System, etc. This will be demonstrated using Windows 7 operating system.

840 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