• Announcements

    • xper

      MSFN Sponsorship and AdBlockers!   07/10/2016

      Dear members, MSFN is made available via subscriptions, donations and advertising revenue. The use of ad-blocking software hurts the site. Please disable ad-blocking software or set an exception for MSFN. Alternatively, become a site sponsor and ads will be disabled automatically and by subscribing you get other sponsor benefits.
ZileXa

Apply regtweaks (also HKCU) and install apps for ALL users

71 posts in this topic

In that case, why not simply use your "manual build process" (please enlighten me, I don't have a clue) and install IE9 unattendedly using Setupcomplete.cmd (wich will run right after useraccount creation but before first login)?

Because I'd rather slipstream it and not waste the extra time to install it after the OS is installed. That's kind of the whole point to all of this. For stuff I can't slipstream I do exactly that, but if it can be slipstreamed, then that's the goal.

0

Share this post


Link to post
Share on other sites

Huh. I just did yet another complete rebuild, and now the sysprep and everything works, even with IE9 slipstreamed. Not that I'm complaining, but man, weird. Now to figure out why Windows Update is prompting me to install IE9 again even though it's already installed via slipstream...

0

Share this post


Link to post
Share on other sites

Oh noo, I did so many rebuilds, not looking forward to that.

But can you please explain what you mean by this:

I was using rt7lite originally as well, and couldn't get the sysprep step to take; it'd just fail in the same way as described above. I then tried switching to a manual build process, and that worked!

Since I am not slipstreaming IE9, this alternative method might work for me.

0

Share this post


Link to post
Share on other sites

By manual I just mean doing everything directly via dism and whatnot, as opposed to using something like rt7lite to automate it. Ie: mount the wim file, manually unpack, patch, and apply the service pack, manually apply other packages, etc. It's been kind of a pain in the rear to get everything setup, but I have a pretty good process worked out now that I've automated with an autoit script. I'll be happy to share the autoit script if you're interested, but it really wasn't developed with redistribution in mind, so it's rather specific in how it does things.

Edited by nitro322
0

Share this post


Link to post
Share on other sites

@ZileXa, did you manage to make it work? for me it's working fine. Also I have a little sugestion to make. I found it on technet. link here

When you run the sysprep /generalize command, out-of-box device drivers are removed from the Windows image. If you add out-of-box device drivers during installation and you intend to capture the Windows image, to persist out-of-box device drivers, in the Microsoft-Windows-PnpSysprep component in the answer file, set PersistAllDeviceInstalls to True. When you do this, Sysprep does not remove the detected device drivers. For more information, see the Unattended Windows Setup Reference (Unattend.chm).

Edited by patronu
0

Share this post


Link to post
Share on other sites

I haven't had time to do a new rebuild. Maybe tonight.

The thing is, I have a slimmed down Windows image without WinSxS with Windows Update working via method 5 described in this topic. All works fine and I do not want to remove less components just because Sysprep doesn't like it.. I will do one more complete rebuild and add also your setting in the answer file. If that doesn't work, I'm just going to set all my usertweaks via RunOnce..

0

Share this post


Link to post
Share on other sites

I don't want to make a slimm version of windows. so that's why I don't have any problems. PersistAllDeviceInstalls and DoNotCleanUpNonPresentDevices are usefull after restarting from sysprep. Without these options windows will start again plug and play detection. The first one,if set to false, willl make setup to detect all the hardwares again. This takes time if done again on the same computer. So it's better to set it to true. And the second one, if set to true, will not remove drivers for hardware that it's not present (when a device is off, like wireless or bluetooth that have an on/off switch). I think in your case the first options it's better because you don't plan to make an standard image and then deploy it to multiple computers.

I found a problem if running sysprep on server 2008 r2 and it seems that it's only visible when running in hyper-v. After running sysprep the hyper-v integration services stops. I have no video card drivers and reinstalling again doesn't help. I see in device manager that device is not connected. help :)

Edited by patronu
0

Share this post


Link to post
Share on other sites

dude, waht you do is enter audit mode, aka Control+Shift+F3 at welcome screen

then you make allof your changes to the profile you want, including registry settings

then you sysprep, and make sure to include the CopyProfile=TRUE

boom, all your settings are applied to EVERY account that will ever be created from that image AKA EXACTLY what your looking for

0

Share this post


Link to post
Share on other sites

Zilexa, did you ever solve this? I am having the same issues. Neither the sysprep reboot, nor the search for the dvd, work for me. The command to find DVDRoot works, but only if I invoke (it does not work from the xml file)

marcusj0015, we want all this to happen automatically (aka unattended)

Edited by mraeryceos
0

Share this post


Link to post
Share on other sites

So you don't have to rebuild autounattend.xml every time***, it's better if you just use a wrapper command, that you copy to windows or system32 (I did it using oem folders in ImgMgr): <path>mycommand.cmd</path>. This is mycommand.cmd, that so far seems to work:

FOR %%i IN (C D E F G H I J K L N M O P Q R S T U V W X Y Z) DO IF EXIST %%i:\$oem$\UnattendedOOBE.xml SET DVDRoot=%%i
REGEDIT /s %DVDRoot%:\$oem$\regtweaks.reg
REGEDIT /s %DVDRoot%:\$oem$\services.reg
xcopy %DVDRoot%:\$oem$\software\*.* d:\software\ /c /e /q /h /r /y /d
xcopy %DVDRoot%:\$oem$\users\default\*.* %userprofile% /c /e /q /h /r /y
C:\Windows\system32\sysprep\sysprep.exe /oobe /generalize /reboot /quiet /unattend:%DVDRoot%:\$oem$\UnattendedOOBE.xml

Now I can alter the cmd file only, without having to rebuild my image. Note that I use two %%, not one, for the variable. I don't know what benefit SETX could have... maybe it makes a permanent addition to SET variables, but, I think I'm only going to use the variable during the audit user path, AFAIK. Also, SETX only works for *future* command prompts, not the current one.

This response is especially dedicated to all you people that figured it out, and didn't post anything, well, except maybe a comment like: "hey dude, I got it to work using this other command I once used, ha ha, and, like, I'm not going to tell you dude, ha ha."

ps. Be careful putting a folder in the windows image, as the builder will ask you if you want to keep it, then you say yes, and it will delete it without going to the recycle bin (as in, F%$K you very much, you're welcome).

*** Oops, I guess you could just edit Autounattend.xml directly... nonetheless, I think it's like trying to use cmdlines.txt in WinXP: you don't have the full abilities of a proper cmd window.

Edited by mraeryceos
0

Share this post


Link to post
Share on other sites

Hi ZileXa,

I am trying to add HKCU entries related to "Action Center Settings". These entries are per user entries and I want to make for all users. I tried to add it according to method given below.

Please see my code attached.

<settings pass="auditUser">

<component name="Microsoft-Windows-Deployment" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<RunSynchronous>

<RunSynchronousCommand wcm:action="add">

<Description>HKCU Entries</Description>

<Order>1</Order>

<Path>CMD.EXE /C C:\AC.cmd</Path>

</RunSynchronousCommand>

</RunSynchronous>

</component>

</settings>

Before capturing WIM file: I copy AC.cmd file(which contains execution of HKCU reg) to C drive. I have even set COPYPROFILE=TRUE. then I run sysprep and capture .WIM file. I don't see HKCU entries after applying this .WIM file. Please help. I am doing all these at least from a month. Please help!!

Completely edited this post because I understand it much better now!

1. AutoUnattend.xml will be used first by Windows Setup.

2. By using this command, Setup reboots into Sysprep mode and AutoUnattend.xml is still being used by setup after the reboot

(this was where you lost me, I thought UnattendOOBE.xml kicked in after this reboot, thats not the case):

	<settings pass="oobeSystem">
<component name="Microsoft-Windows-Deployment">
<Reseal>
<Mode>Audit</Mode>
</Reseal>
</component>
</settings>

3. Also, this code is needed to make sure everything that happens after the above mentioned reboot-into-sysprep will be copied to the defaultprofile:

  <settings pass="specialize">
<component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="NonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" />
<component name="Microsoft-Windows-Security-Licensing-SLC-UX" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="NonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SkipAutoActivation>true</SkipAutoActivation>
</component>
<component name="Microsoft-Windows-Shell-Setup">
<CopyProfile>true</CopyProfile
</component>
</settings>

4. So Setup has rebooted and is in sysprep state. Setup will now look at settings pass auditUser and perform the commands there (Setup is still reading AutoUnattend.xml):

	<settings pass="auditUser">
<component name="Microsoft-Windows-Deployment">
<RunSynchronous>
<RunSynchronousCommand wcm:action="add">
<Order>490</Order>
<Path>cmd /c "FOR %i IN (C D E F G H I J K L N M O P Q R S T U V W X Y Z) DO IF EXIST %i:\UnattendedOOBE.xml SETX DVDRoot %i:"</Path>
<Description>Set Path For DVD</Description>
</RunSynchronousCommand>
<RunSynchronousCommand wcm:action="add">
<Order>495</Order>
<Description>Install apps and HKCU + HKLM regtweaks</Description>
<Path>cmd /c %DVDRoot%\InstallAppsTweaks.cmd</Path>
</RunSynchronousCommand>
<RunSynchronousCommand wcm:action="add">
<Order>500</Order>
<Description>Reboot into OOBE With Unattend lacking reseal</Description>
<Path>C:\Windows\system32\sysprep\sysprep.exe /quiet /oobe /reboot /generalize /unattend:%DVDRoot%\UnattendedOOBE.xml</Path>
</RunSynchronousCommand>
</RunSynchronous>
</component>
</settings>

5. Note the final command in the code above, Setup will reboot again. After reboot Setup will no longer use AutoUnattend.xml. Instead UnattendedOOBE.xml is used.

UnattendedOOBE.xml is an exact copy of AutoUnattend.xml but it misses the code from step (1) therefore, the code in step (4) is completely ignored.

--> Is this correct?

--> Is it safe to leave the code from step 3 in UnattendedOOBE.xml? Since it's a copy of AutoUnattend minus the code in step (1).

--> I still wonder how and when everything is copied to the default user since you reboot again at the end of step (4), not giving the system any chance to copy everything to the default profile!

(edit: btw I am NOT modifying WIM before I create my ISO image. All the setupfiles/installers of my apps are in %dvdroot%\Apps and I use a .cmd file to install them silently, clean up start menu, copy predefined startmenu, add pins to taskbar/startmenu and run a regtweaks.reg file). So I rebuilding indexes doesnt apply here.)

Please note before replying this post has completely been modified (I tend to read a message in my mail, come to the forum and immediately start my response without noticing changes to the post I am replying to).

0

Share this post


Link to post
Share on other sites

I have had similar problems running sysprep, especially when using an image created by rt7lite,

I found the problem was that when you use rt7lite to strip items out it left registry entries

In the case of sysprep, there are registry entries at HKLM\Software\Microsoft\Windows\CurrentVersion\Setup\Sysprep

Which were looking for DLL files which were missing from the system.

The workaround was to remove the entries, then sysprep worked.

0

Share this post


Link to post
Share on other sites

I have found that sometimes when running on a virtual machine, setup will fail with the popup like shown below:

Once the XML worked... Setup continued but after rebooting into sysprep, input was required! The InstallApps.cmd file was never called. See the screenshot below.

aMxIM.jpg

The error happens after running the command:

C:\Windows\system32\sysprep\sysprep.exe /quiet /oobe /reboot /generalize /unattend:%DVDRoot%\UnattendedOOBE.xml

When this command runs, it tries to copy the UnattendedOOBE.xml file to C:\Windows\Panther directory with the name autounattend.xml. For some reason it fails to copy the file.

It seems to ignore the fact that the file failed to copy. It will then try and load the autounattend.xml from C:\Windows\Panther, but it will be the old one instead of the new one. You will also find the old one has been modified during the setup process already, marking it as having already been run.

Because the stages have already been run, sysprep will not execute it again (it would go into an infinite loop of applying registry tweaks / generalizing / rebooting if it did run it again). So instead, it opens the prompt shown in screenshot above.

This same problem does not happen when run on a physical machine, so it may be that it doesn't work in your virtual machine but it does work on phsyical ones.

As a workaround, you can manually copy or hand-edit the unattend file to match UnattendedOOBE.xml and then execute the command again from a command prompt. Setup will complete as normal.

NOTE: I will try and remember to pull the lines from the sysprep.log next time i see this happen and place them here.

0

Share this post


Link to post
Share on other sites

I would like to see the Action Center settings. I never managed to find any, and I don't think these are saved upon generalizing anyway.

0

Share this post


Link to post
Share on other sites

@SmokingRope

Usually when I go into audit I shutdown sysprep first off CMD /C taskkill /IM sysprep.exe and call it later with command like yours

Are you running something prior to set your %DVDRoot% variable?

@TheWalrus

You mean these? I apply at Firstlogoncommands so that after generalizing

registry removed. use the autoit script below

Edited by maxXPsoft
0

Share this post


Link to post
Share on other sites

Yup, that sort of things. Are there more?

When I configured Action center manually and then generalized and captured the image, those settings did not carry over at all :(

0

Share this post


Link to post
Share on other sites

I have this script that i copy to the startup folder of the default user.

Fine tuning may be needed :)

autoit script



BlockInput(1)
ActionCenterNotifications()
_SelfDelete(5)
BlockInput(0)

Func ActionCenterNotifications()
Dim $HoldReg, $HoldProblem, $UnCheckWindowsUpdate, $UnCheckSpyware, $UnCheckInternet, $UnCheckUAC, $UnCheckFirewall, $UnCheckVirus, $UnCheckBackup, $UnCheckCheckUpdates, $UnCheckTroubleshooting

$UnCheckWindowsUpdate = 1
$UnCheckSpyware = 0
$UnCheckInternet = 0
$UnCheckUAC = 1
$UnCheckFirewall = 0
$UnCheckVirus = 0
$UnCheckBackup = 1
$UnCheckCheckUpdates = 1
$UnCheckTroubleshooting = 1

If $UnCheckWindowsUpdate+$UnCheckSpyware+$UnCheckInternet+$UnCheckUAC+$UnCheckFirewall+$UnCheckVirus+$UnCheckBackup+$UnCheckCheckUpdates+$UnCheckTroubleshooting <> 0 Then
Run("rundll32.exe shell32.dll,Control_RunDLL wscui.cpl")
Sleep(5000)
Send("+{TAB}") ;shift-tab
Send("+{TAB}")
Send("+{TAB}")
Send("+{TAB}")
Send("+{TAB}")
Send("+{TAB}")
Send("+{TAB}")
Send("+{TAB}")
Send("{ENTER}")
Sleep(500)
Send("{TAB}")
If $UnCheckWindowsUpdate Then
Send("{SPACE}")
EndIf
Send("{TAB}")
If $UnCheckSpyware Then
Send("{SPACE}")
EndIf
Send("{TAB}")
If $UnCheckInternet Then
Send("{SPACE}")
EndIf
Send("{TAB}")
If $UnCheckUAC Then
Send("{SPACE}")
EndIf
Send("{TAB}")
If $UnCheckFirewall Then
Send("{SPACE}")
EndIf
Send("{TAB}")
If $UnCheckVirus Then
Send("{SPACE}")
EndIf
Send("{TAB}")
If $UnCheckBackup Then
Send("{SPACE}")
EndIf
Send("{TAB}")
If $UnCheckCheckUpdates Then
Send("{SPACE}")
EndIf
Send("{TAB}")
If $UnCheckTroubleshooting Then
Send("{SPACE}")
EndIf
Send("{TAB}")
Send("{TAB}")
Send("{TAB}")
Send("{TAB}")
Sleep(500)
Send("{ENTER}")
Sleep(500)
Send ("!{F4}" );alt-f4
EndIf
EndFunc

Func _SelfDelete($iDelay = 0)
Local $sCmdFile
FileDelete(@TempDir & "\deleteme.cmd")
$sCmdFile = 'ping -n ' & $iDelay & '127.0.0.1 > nul' & @CRLF _
& ':loop' & @CRLF _
& 'DEL /F /Q "' & @ScriptFullPath & '" > nul' & @CRLF _
& 'if exist "' & @ScriptFullPath & '" goto loop' & @CRLF _
& 'DEL %0'
FileWrite(@TempDir & "\deleteme.cmd", $sCmdFile)
Run(@TempDir & "\deleteme.cmd", @TempDir, @SW_HIDE)
EndFunc

Edited by The Glimmerman
0

Share this post


Link to post
Share on other sites

I have this script that i copy to the startup folder of the default user.

Fine tuning may be needed :)

That worked great here :thumbup

0

Share this post


Link to post
Share on other sites

I have this script that i copy to the startup folder of the default user.

Fine tuning may be needed :)

Thanks for this tip!

I think this AutoIt script works with all languages, isn't it?

Regards

*Edit: Tested and works fine also on Windows 7 French language. And the au3 file is removed at the end of its execution.

Edited by myselfidem
0

Share this post


Link to post
Share on other sites

@SmokingRope

Usually when I go into audit I shutdown sysprep first off CMD /C taskkill /IM sysprep.exe and call it later with command like yours

Are you running something prior to set your %DVDRoot% variable?

I'm doing unattended installations using a usb key now. I pull the usb key out as soon as files finish copying so i cant use this DVDROOT tweak. Instead i copy the UnattendedOOBE.xml file into the wim image in a folder C:\Settings\UnattendedOOBE.xml

My commandline actually looks as follows:


C:\Windows\system32\sysprep\sysprep.exe /quiet /oobe /reboot /generalize /unattend:C:\Settings\UnattendedOOBE.xml

I tried to reproduce the error on a Virtual Box virtual machine but installation worked fine. Hopefully i can find some time to try this on VMWare Server 2 next.

Did you include that task kill command because you saw the same errors i was seeing?

Edited by SmokingRope
0

Share this post


Link to post
Share on other sites

I just taskkill /IM sysprep when entering Audit because I found sometimes it would just come up and be just a window sitting there. Then my sysprep command line wouldn't work

My commandline actually looks as follows:
is that in your xml? Then just place taskkill in a command right before
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.