ZileXa

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

71 posts in this topic

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.