Skip to content

Commit 56bd18f

Browse files
Cleanup
1 parent 5c8adf3 commit 56bd18f

File tree

1 file changed

+46
-12
lines changed

1 file changed

+46
-12
lines changed

functions/private/Invoke-WinUtilISOScript.ps1

Lines changed: 46 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,65 @@
11
function Invoke-WinUtilISOScript {
22
<#
33
.SYNOPSIS
4-
Applies the standard WinUtil modifications to a mounted Windows 11 install.wim image.
4+
Applies WinUtil modifications to a mounted Windows 11 install.wim image.
55
66
.DESCRIPTION
7-
Removes bloatware AppX packages, Edge, OneDrive, applies privacy/telemetry
8-
registry tweaks, disables sponsored-app delivery, bypasses hardware checks,
9-
copies autounattend.xml for local-account OOBE, and deletes unwanted
10-
scheduled-task definition files — all against an already-mounted WIM image.
7+
Performs the following operations against an already-mounted WIM image:
8+
9+
1. Removes provisioned AppX bloatware packages via DISM.
10+
2. Deletes Microsoft Edge program files.
11+
3. Removes OneDriveSetup.exe from the system image.
12+
4. Loads offline registry hives (COMPONENTS, DEFAULT, NTUSER, SOFTWARE, SYSTEM)
13+
and applies the following tweaks:
14+
- Bypasses hardware requirement checks (CPU, RAM, SecureBoot, Storage, TPM).
15+
- Disables sponsored-app delivery and ContentDeliveryManager features.
16+
- Enables local-account OOBE path (BypassNRO).
17+
- Writes autounattend.xml to the Sysprep directory inside the WIM and,
18+
optionally, to the ISO/USB root so Windows Setup picks it up at boot.
19+
- Disables reserved storage.
20+
- Disables BitLocker device encryption.
21+
- Hides the Chat (Teams) taskbar icon.
22+
- Removes Edge uninstall registry entries.
23+
- Disables OneDrive folder backup (KFM).
24+
- Disables telemetry, advertising ID, and input personalization.
25+
- Blocks post-install delivery of DevHome, Outlook, and Teams.
26+
- Disables Windows Copilot.
27+
- Disables Windows Update during OOBE.
28+
5. Deletes unwanted scheduled-task XML definition files (CEIP, Appraiser, etc.).
29+
6. Removes the support\ folder from the ISO contents directory (if supplied).
1130
1231
Mounting and dismounting the WIM is the responsibility of the caller
13-
(e.g. Invoke-WinUtilISOModify).
32+
(e.g. Invoke-WinUtilISO).
1433
1534
.PARAMETER ScratchDir
16-
Full path to the directory where the Windows image is currently mounted
17-
(the "scratchdir"). Example: C:\Temp\WinUtil_Win11ISO_20260222\wim_mount
35+
Mandatory. Full path to the directory where the Windows image is currently mounted.
36+
Example: C:\Users\USERNAME\AppData\Local\Temp\WinUtil_Win11ISO_20260222\wim_mount
37+
38+
.PARAMETER ISOContentsDir
39+
Optional. Root directory of the extracted ISO contents.
40+
When supplied, autounattend.xml is also written here so Windows Setup picks it
41+
up automatically at boot, and the support\ folder is deleted from that location.
42+
43+
.PARAMETER AutoUnattendXml
44+
Optional. Full XML content for autounattend.xml.
45+
In compiled winutil.ps1 this is the embedded $WinUtilAutounattendXml here-string;
46+
in dev mode it is read from tools\autounattend.xml.
47+
If empty, the OOBE bypass file is skipped and a warning is logged.
1848
1949
.PARAMETER Log
2050
Optional ScriptBlock used for progress/status logging.
2151
Receives a single [string] message argument.
22-
Defaults to Write-Output when not supplied.
52+
Defaults to { param($m) Write-Output $m } when not supplied.
2353
2454
.EXAMPLE
2555
Invoke-WinUtilISOScript -ScratchDir "C:\Temp\wim_mount"
26-
Invoke-WinUtilISOScript -ScratchDir $mountDir -Log { param($m) Write-Host $m }
56+
57+
.EXAMPLE
58+
Invoke-WinUtilISOScript `
59+
-ScratchDir $mountDir `
60+
-ISOContentsDir $isoRoot `
61+
-AutoUnattendXml (Get-Content .\tools\autounattend.xml -Raw) `
62+
-Log { param($m) Write-Host $m }
2763
2864
.NOTES
2965
Author : Chris Titus @christitustech
@@ -114,14 +150,12 @@ function Invoke-WinUtilISOScript {
114150
'Microsoft.WindowsFeedbackHub',
115151
'Microsoft.WindowsMaps',
116152
'Microsoft.WindowsSoundRecorder',
117-
'Microsoft.WindowsTerminal',
118153
'Microsoft.ZuneMusic',
119154
'Microsoft.ZuneVideo',
120155
'MicrosoftCorporationII.MicrosoftFamily',
121156
'MicrosoftCorporationII.QuickAssist',
122157
'MSTeams',
123158
'MicrosoftTeams',
124-
'Microsoft.549981C3F5F10'
125159
)
126160

127161
$packagesToRemove = $packages | Where-Object {

0 commit comments

Comments
 (0)