|
1 | 1 | function Invoke-WinUtilISOScript { |
2 | 2 | <# |
3 | 3 | .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. |
5 | 5 |
|
6 | 6 | .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). |
11 | 30 |
|
12 | 31 | Mounting and dismounting the WIM is the responsibility of the caller |
13 | | - (e.g. Invoke-WinUtilISOModify). |
| 32 | + (e.g. Invoke-WinUtilISO). |
14 | 33 |
|
15 | 34 | .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. |
18 | 48 |
|
19 | 49 | .PARAMETER Log |
20 | 50 | Optional ScriptBlock used for progress/status logging. |
21 | 51 | 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. |
23 | 53 |
|
24 | 54 | .EXAMPLE |
25 | 55 | 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 } |
27 | 63 |
|
28 | 64 | .NOTES |
29 | 65 | Author : Chris Titus @christitustech |
@@ -114,14 +150,12 @@ function Invoke-WinUtilISOScript { |
114 | 150 | 'Microsoft.WindowsFeedbackHub', |
115 | 151 | 'Microsoft.WindowsMaps', |
116 | 152 | 'Microsoft.WindowsSoundRecorder', |
117 | | - 'Microsoft.WindowsTerminal', |
118 | 153 | 'Microsoft.ZuneMusic', |
119 | 154 | 'Microsoft.ZuneVideo', |
120 | 155 | 'MicrosoftCorporationII.MicrosoftFamily', |
121 | 156 | 'MicrosoftCorporationII.QuickAssist', |
122 | 157 | 'MSTeams', |
123 | 158 | 'MicrosoftTeams', |
124 | | - 'Microsoft.549981C3F5F10' |
125 | 159 | ) |
126 | 160 |
|
127 | 161 | $packagesToRemove = $packages | Where-Object { |
|
0 commit comments