Skip to content

Commit d78737e

Browse files
authored
Added compatibility for 32-bit Windows
1 parent 2df00e4 commit d78737e

1 file changed

Lines changed: 221 additions & 25 deletions

File tree

autounattend.xml

Lines changed: 221 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,43 @@
44
xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State">
55
<settings pass="offlineServicing"></settings>
66
<settings pass="windowsPE">
7+
<component name="Microsoft-Windows-Setup" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS">
8+
<UserData>
9+
<ProductKey>
10+
<Key>00000-00000-00000-00000-00000</Key>
11+
</ProductKey>
12+
<AcceptEula>true</AcceptEula>
13+
</UserData>
14+
<RunSynchronous>
15+
<!--Prevents auto detection of Windows Edition and forces Windows Setup to show all available Editions of Windows during setup.-->
16+
<RunSynchronousCommand wcm:action="add">
17+
<Order>1</Order>
18+
<Path>cmd.exe /c del /f /q X:\Sources\ei.cfg</Path>
19+
</RunSynchronousCommand>
20+
<RunSynchronousCommand wcm:action="add">
21+
<Order>2</Order>
22+
<Path>cmd.exe /c echo [Channel] > X:\Sources\ei.cfg</Path>
23+
</RunSynchronousCommand>
24+
<RunSynchronousCommand wcm:action="add">
25+
<Order>3</Order>
26+
<Path>cmd.exe /c echo _Default >> X:\Sources\ei.cfg</Path>
27+
</RunSynchronousCommand>
28+
<RunSynchronousCommand wcm:action="add">
29+
<Order>4</Order>
30+
<Path>cmd.exe /c echo [VL] >> X:\Sources\ei.cfg</Path>
31+
</RunSynchronousCommand>
32+
<RunSynchronousCommand wcm:action="add">
33+
<Order>5</Order>
34+
<Path>cmd.exe /c echo 0 >> X:\Sources\ei.cfg</Path>
35+
</RunSynchronousCommand>
36+
</RunSynchronous>
37+
</component>
738
<component name="Microsoft-Windows-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS">
839
<UserData>
9-
<AcceptEula>true</AcceptEula>
1040
<ProductKey>
1141
<Key>00000-00000-00000-00000-00000</Key>
12-
<WillShowUI>Always</WillShowUI>
13-
<!-- This ensures the UI will show to select the edition of Windows -->
1442
</ProductKey>
43+
<AcceptEula>true</AcceptEula>
1544
</UserData>
1645
<RunSynchronous>
1746
<!--Bypass Windows 11 System Requirements-->
@@ -39,11 +68,146 @@
3968
<Order>6</Order>
4069
<Path>reg.exe add "HKLM\SYSTEM\Setup\LabConfig" /v BypassDiskCheck /t REG_DWORD /d 1 /f</Path>
4170
</RunSynchronousCommand>
71+
<!--Prevents auto detection of Windows Edition and forces Windows Setup to show all available Editions of Windows during setup.-->
72+
<RunSynchronousCommand wcm:action="add">
73+
<Order>7</Order>
74+
<Path>cmd.exe /c del /f /q X:\Sources\ei.cfg</Path>
75+
</RunSynchronousCommand>
76+
<RunSynchronousCommand wcm:action="add">
77+
<Order>8</Order>
78+
<Path>cmd.exe /c echo [Channel] > X:\Sources\ei.cfg</Path>
79+
</RunSynchronousCommand>
80+
<RunSynchronousCommand wcm:action="add">
81+
<Order>9</Order>
82+
<Path>cmd.exe /c echo _Default >> X:\Sources\ei.cfg</Path>
83+
</RunSynchronousCommand>
84+
<RunSynchronousCommand wcm:action="add">
85+
<Order>10</Order>
86+
<Path>cmd.exe /c echo [VL] >> X:\Sources\ei.cfg</Path>
87+
</RunSynchronousCommand>
88+
<RunSynchronousCommand wcm:action="add">
89+
<Order>11</Order>
90+
<Path>cmd.exe /c echo 0 >> X:\Sources\ei.cfg</Path>
91+
</RunSynchronousCommand>
4292
</RunSynchronous>
4393
</component>
4494
</settings>
4595
<settings pass="generalize"></settings>
4696
<settings pass="specialize">
97+
<component name="Microsoft-Windows-Deployment" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS">
98+
<RunSynchronous>
99+
<RunSynchronousCommand wcm:action="add">
100+
<Order>1</Order>
101+
<Description>Extracts and Executes Scripts in this XML File</Description>
102+
<Path>powershell.exe -NoProfile -Command "$xml = [xml]::new(); $xml.Load('C:\Windows\Panther\unattend.xml'); $sb = [scriptblock]::Create( $xml.unattend.Extensions.ExtractScript ); Invoke-Command -ScriptBlock $sb -ArgumentList $xml;"</Path>
103+
</RunSynchronousCommand>
104+
<RunSynchronousCommand wcm:action="add">
105+
<Order>2</Order>
106+
<Description>Loads the Default User Registry Hive so Changes Can be Made to It</Description>
107+
<Path>reg.exe load "HKU\DefaultUser" "C:\Users\Default\NTUSER.DAT"</Path>
108+
</RunSynchronousCommand>
109+
<RunSynchronousCommand wcm:action="add">
110+
<Order>3</Order>
111+
<Description>Executes the remove-packages Powershell Script</Description>
112+
<Path>powershell.exe -NoProfile -Command "Get-Content -LiteralPath '%TEMP%\remove-packages.ps1' -Raw | Invoke-Expression;"</Path>
113+
</RunSynchronousCommand>
114+
<RunSynchronousCommand wcm:action="add">
115+
<Order>4</Order>
116+
<Description>Executes the remove-caps Powershell Script</Description>
117+
<Path>powershell.exe -NoProfile -Command "Get-Content -LiteralPath '%TEMP%\remove-caps.ps1' -Raw | Invoke-Expression;"</Path>
118+
</RunSynchronousCommand>
119+
<RunSynchronousCommand wcm:action="add">
120+
<Order>5</Order>
121+
<Description>Executes the remove-features Powershell Script</Description>
122+
<Path>powershell.exe -NoProfile -Command "Get-Content -LiteralPath '%TEMP%\remove-features.ps1' -Raw | Invoke-Expression;"</Path>
123+
</RunSynchronousCommand>
124+
<RunSynchronousCommand wcm:action="add">
125+
<Order>6</Order>
126+
<Description>Run Chris Titus WinUtil Tweaks</Description>
127+
<Path>cmd.exe /c "powershell.exe -NoProfile -ExecutionPolicy Bypass -Command "Get-Content -LiteralPath 'C:\Windows\Setup\Scripts\wintweaks.ps1' -Raw | Invoke-Expression;" &gt;&gt;"C:\Windows\Setup\Scripts\wintweaks.log" 2&gt;&amp;1"</Path>
128+
</RunSynchronousCommand>
129+
<RunSynchronousCommand wcm:action="add">
130+
<Order>7</Order>
131+
<Description>Executes the HKLM Registry Entries Script</Description>
132+
<Path>cmd.exe /c "C:\Windows\Setup\Scripts\localmachine.cmd &gt;&gt;"C:\Windows\Setup\Scripts\localmachine.log" 2&gt;&amp;1"</Path>
133+
</RunSynchronousCommand>
134+
<RunSynchronousCommand wcm:action="add">
135+
<Order>8</Order>
136+
<Description>Registry Entry to Execute the HKCU Registry Entry Script the First Time a New User Logs In</Description>
137+
<Path>reg.exe add "HKU\DefaultUser\Software\Microsoft\Windows\CurrentVersion\Runonce" /v "currentuser" /t REG_SZ /d "C:\Windows\Setup\Scripts\currentuser.cmd" /f</Path>
138+
</RunSynchronousCommand>
139+
<RunSynchronousCommand wcm:action="add">
140+
<Order>9</Order>
141+
<Description>Registry Entry to Execute the HKU\DefaultUser Registry Entries Script</Description>
142+
<Path>cmd.exe /c "C:\Windows\Setup\Scripts\defaultuser.cmd &gt;&gt;"C:\Windows\Setup\Scripts\defaultuser.log" 2&gt;&amp;1"</Path>
143+
</RunSynchronousCommand>
144+
<RunSynchronousCommand wcm:action="add">
145+
<Order>10</Order>
146+
<Description>Executes the EdgeRemoval batch file</Description>
147+
<Path>cmd.exe /c "C:\Windows\Setup\Scripts\edgeremoval.bat &gt;&gt;"C:\Windows\Setup\Scripts\edgeremoval.log" 2&gt;&amp;1"</Path>
148+
</RunSynchronousCommand>
149+
<RunSynchronousCommand wcm:action="add">
150+
<Order>11</Order>
151+
<Description>Delete WFS.exe from System32</Description>
152+
<Path>cmd.exe /c del "C:\Windows\System32\WFS.exe"</Path>
153+
</RunSynchronousCommand>
154+
<RunSynchronousCommand wcm:action="add">
155+
<Order>12</Order>
156+
<Description>Delete SnippingTool.exe from System32</Description>
157+
<Path>cmd.exe /c del "C:\Windows\System32\SnippingTool.exe"</Path>
158+
</RunSynchronousCommand>
159+
<RunSynchronousCommand wcm:action="add">
160+
<Order>13</Order>
161+
<Description>Delete mstsc.exe from System32</Description>
162+
<Path>cmd.exe /c del "C:\Windows\System32\mstsc.exe"</Path>
163+
</RunSynchronousCommand>
164+
<RunSynchronousCommand wcm:action="add">
165+
<Order>14</Order>
166+
<Description>Delete wordpad.exe</Description>
167+
<Path>cmd.exe /c rmdir /s /q "C:\Program Files\Windows NT\Accessories"</Path>
168+
</RunSynchronousCommand>
169+
<RunSynchronousCommand wcm:action="add">
170+
<Order>15</Order>
171+
<Description>Delete Windows Fax and Scan shortcut</Description>
172+
<Path>cmd.exe /c del "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Accessories\Windows Fax and Scan.lnk"</Path>
173+
</RunSynchronousCommand>
174+
<RunSynchronousCommand wcm:action="add">
175+
<Order>16</Order>
176+
<Description>Delete Remote Desktop Connection shortcut</Description>
177+
<Path>cmd.exe /c del "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Accessories\Remote Desktop Connection.lnk"</Path>
178+
</RunSynchronousCommand>
179+
<RunSynchronousCommand wcm:action="add">
180+
<Order>17</Order>
181+
<Description>Delete Snipping Tool shortcut</Description>
182+
<Path>cmd.exe /c del "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Accessories\Snipping Tool.lnk"</Path>
183+
</RunSynchronousCommand>
184+
<RunSynchronousCommand wcm:action="add">
185+
<Order>18</Order>
186+
<Description>Delete Wordpad shortcut</Description>
187+
<Path>cmd.exe /c del "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Accessories\Wordpad.lnk"</Path>
188+
</RunSynchronousCommand>
189+
<RunSynchronousCommand wcm:action="add">
190+
<Order>19</Order>
191+
<Description>Delete charmap.exe shortcut</Description>
192+
<Path>cmd.exe /c rmdir /s /q "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Accessories\System Tools"</Path>
193+
</RunSynchronousCommand>
194+
<RunSynchronousCommand wcm:action="add">
195+
<Order>20</Order>
196+
<Description>Remove Edge using EdgeRemover script</Description>
197+
<Path>powershell.exe -NoProfile -ExecutionPolicy Bypass -Command "iex &amp;{$(irm https://cdn.jsdelivr.net/gh/he3als/EdgeRemover@main/get.ps1)} -UninstallEdge -RemoveEdgeData"</Path>
198+
</RunSynchronousCommand>
199+
<RunSynchronousCommand wcm:action="add">
200+
<Order>21</Order>
201+
<Description>Unloads the Default User Registry Hive</Description>
202+
<Path>reg.exe unload "HKU\DefaultUser"</Path>
203+
</RunSynchronousCommand>
204+
<RunSynchronousCommand wcm:action="add">
205+
<Order>22</Order>
206+
<Description>Disable All Network Adapters Temporarily so Windows Doesn't Update During OOBE</Description>
207+
<Path>powershell.exe -NoProfile -WindowStyle Hidden -ExecutionPolicy Bypass -Command "Get-NetAdapter | Disable-NetAdapter -Confirm:$false"</Path>
208+
</RunSynchronousCommand>
209+
</RunSynchronous>
210+
</component>
47211
<component name="Microsoft-Windows-Deployment" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS">
48212
<RunSynchronous>
49213
<RunSynchronousCommand wcm:action="add">
@@ -156,23 +320,56 @@
156320
<Description>Unloads the Default User Registry Hive</Description>
157321
<Path>reg.exe unload "HKU\DefaultUser"</Path>
158322
</RunSynchronousCommand>
323+
<RunSynchronousCommand wcm:action="add">
324+
<Order>23</Order>
325+
<Description>Disable All Network Adapters Temporarily so Windows Doesn't Update During OOBE</Description>
326+
<Path>powershell.exe -NoProfile -WindowStyle Hidden -ExecutionPolicy Bypass -Command "Get-NetAdapter | Disable-NetAdapter -Confirm:$false"</Path>
327+
</RunSynchronousCommand>
159328
</RunSynchronous>
160329
</component>
161330
</settings>
162331
<settings pass="auditSystem"></settings>
163332
<settings pass="auditUser"></settings>
164333
<settings pass="oobeSystem">
165-
<component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS">
334+
<component name="Microsoft-Windows-Shell-Setup" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS">
166335
<OOBE>
167-
<HideEULAPage>true</HideEULAPage>
168-
<HideOEMRegistrationScreen>true</HideOEMRegistrationScreen>
169-
<HideOnlineAccountScreens>true</HideOnlineAccountScreens>
170-
<NetworkLocation>Work</NetworkLocation>
171-
<ProtectYourPC>3</ProtectYourPC>
336+
<HideEULAPage>true</HideEULAPage>
337+
<HideOEMRegistrationScreen>true</HideOEMRegistrationScreen>
338+
<HideOnlineAccountScreens>true</HideOnlineAccountScreens>
339+
<HideWirelessSetupInOOBE>true</HideWirelessSetupInOOBE>
340+
<NetworkLocation>Work</NetworkLocation>
341+
<ProtectYourPC>3</ProtectYourPC>
172342
</OOBE>
173343
<FirstLogonCommands>
344+
<SynchronousCommand>
345+
<Order>1</Order>
346+
<CommandLine>powershell.exe -NoProfile -WindowStyle Hidden -ExecutionPolicy Bypass -Command "Get-NetAdapter | Enable-NetAdapter -Confirm:$false"</CommandLine>
347+
<Description>Enables Network Adapters After OOBE Completes</Description>
348+
</SynchronousCommand>
174349
<SynchronousCommand wcm:action="add">
350+
<Order>2</Order>
351+
<CommandLine>cmd /c copy C:\Windows\Setup\Scripts\Browser_Downloader.bat %UserProfile%\Desktop\Browser_Downloader.bat</CommandLine>
352+
<Description>Create Browser_Downloader.bat on Desktop</Description>
353+
</SynchronousCommand>
354+
</FirstLogonCommands>
355+
</component>
356+
<component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS">
357+
<OOBE>
358+
<HideEULAPage>true</HideEULAPage>
359+
<HideOEMRegistrationScreen>true</HideOEMRegistrationScreen>
360+
<HideOnlineAccountScreens>true</HideOnlineAccountScreens>
361+
<HideWirelessSetupInOOBE>true</HideWirelessSetupInOOBE>
362+
<NetworkLocation>Work</NetworkLocation>
363+
<ProtectYourPC>3</ProtectYourPC>
364+
</OOBE>
365+
<FirstLogonCommands>
366+
<SynchronousCommand>
175367
<Order>1</Order>
368+
<CommandLine>powershell.exe -NoProfile -WindowStyle Hidden -ExecutionPolicy Bypass -Command "Get-NetAdapter | Enable-NetAdapter -Confirm:$false"</CommandLine>
369+
<Description>Enables Network Adapters After OOBE Completes</Description>
370+
</SynchronousCommand>
371+
<SynchronousCommand wcm:action="add">
372+
<Order>2</Order>
176373
<CommandLine>cmd /c copy C:\Windows\Setup\Scripts\Browser_Downloader.bat %UserProfile%\Desktop\Browser_Downloader.bat</CommandLine>
177374
<Description>Create Browser_Downloader.bat on Desktop</Description>
178375
</SynchronousCommand>
@@ -480,6 +677,9 @@ foreach ($line in $lines) {
480677
if ($architecture -eq 'x64') {
481678
$architecture = 'amd64'
482679
}
680+
elseif ($architecture -eq 'x86') {
681+
$architecture = 'x86'
682+
}
483683
Write-Host "Architecture: $architecture"
484684
break
485685
}
@@ -496,29 +696,25 @@ Remove-Item -Path "C:\Users\Public\Desktop\Microsoft Edge.lnk" -Recurse -Force -
496696
Remove-Item -Path "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Microsoft Edge.lnk" -Recurse -Force -ErrorAction Continue
497697
Remove-Item -Path "C:\Windows\SystemApps\Microsoft.MicrosoftEdge_8wekyb3d8bbwe" -Recurse -Force -ErrorAction Continue
498698
Remove-Item -Path "C:\Windows\SystemApps\Microsoft.MicrosoftEdgeDevToolsClient_8wekyb3d8bbwe" -Recurse -Force -ErrorAction Continue
699+
499700
if ($architecture -eq 'amd64') {
500701
$folderPath = Get-ChildItem -Path "C:\Windows\WinSxS" -Filter "amd64_microsoft-edge-webview_31bf3856ad364e35*" -Directory | Select-Object -ExpandProperty FullName
501-
502-
if ($folderPath) {
503-
& 'takeown' '/f' $folderPath '/r'
504-
& icacls $folderPath "/grant" "$($adminGroup.Value):(F)" '/T' '/C'
505-
Remove-Item -Path $folderPath -Recurse -Force
506-
} else {
507-
Write-Host "Folder not found."
508-
}
509702
} elseif ($architecture -eq 'arm64') {
510703
$folderPath = Get-ChildItem -Path "C:\Windows\WinSxS" -Filter "arm64_microsoft-edge-webview_31bf3856ad364e35*" -Directory | Select-Object -ExpandProperty FullName
511-
512-
if ($folderPath) {
513-
& 'takeown' '/f' $folderPath '/r'
514-
& icacls $folderPath "/grant" "$($adminGroup.Value):(F)" '/T' '/C'
515-
Remove-Item -Path $folderPath -Recurse -Force
516-
} else {
517-
Write-Host "Folder not found."
518-
}
704+
} elseif ($architecture -eq 'x86') {
705+
$folderPath = Get-ChildItem -Path "C:\Windows\WinSxS" -Filter "x86_microsoft-edge-webview_31bf3856ad364e35*" -Directory | Select-Object -ExpandProperty FullName
519706
} else {
520707
Write-Host "Unknown architecture: $architecture"
521708
}
709+
710+
if ($folderPath) {
711+
& 'takeown' '/f' $folderPath '/r'
712+
& icacls $folderPath "/grant" "$($adminGroup.Value):(F)" '/T' '/C'
713+
Remove-Item -Path $folderPath -Recurse -Force
714+
} else {
715+
Write-Host "Folder not found."
716+
}
717+
522718
& 'takeown' '/f' "C:\Windows\System32\Microsoft-Edge-Webview" '/r'
523719
& 'icacls' "C:\Windows\System32\Microsoft-Edge-Webview" '/grant' "$($adminGroup.Value):(F)" '/T' '/C'
524720
Remove-Item -Path "C:\Windows\System32\Microsoft-Edge-Webview" -Recurse -Force

0 commit comments

Comments
 (0)