Reduce the size of the uupdump ISO by approximately 2GB


jen1

Well-known member
Member
Local time
3:36 PM
Posts
96
OS
Windows 11 vmware
You can reduce the size of the ISO file by approximately 2GB by applying the following commands to the convert-UUP.cmd script. This script will be downloaded immediately and can be edited to include the new commands.

Steps to Modify convert-UUP.cmd

1-Remove Unnecessary Copy of EdgeWebView:
This command removes an unnecessary copy of EdgeWebView from the WinSxS folder. If not removed, it will be updated unnecessarily with each cumulative update. Add the following two lines after :updatewim (line 2680, where uivr=v114 is defined):

Code:
DISM /Image:C:\MountUUP /remove-package /packagename:Microsoft-Edge-WebView-FOD-Package~31bf3856ad364e35~amd64~~10.0.26100.1
DISM /Image:C:\MountUUP /Cleanup-Image /StartComponentCleanup /ResetBase


2-Remove Old Package:
This command removes an old package that was overlooked by Microsoft. Add the following two lines after :cleanup (line 3875, where uivr=v114 is defined):

Code:
DISM /Image:C:\MountUUP /remove-package /packagename:Package_for_RollupFix~31bf3856ad364e35~amd64~~26100.1742.1.10
DISM /Image:C:\MountUUP /Cleanup-Image /StartComponentCleanup /ResetBase


Important Notes:
* It is essential to apply the /ResetBase option; otherwise, the packages will not be removed successfully.
* Please change C:\MountUUP to your Mount folder if it has been redefined.
 
Last edited:

My Computer My Computer

At a glance

Windows 11 vmwareI9 13950hx128GBNVIDIA 4090
OS
Windows 11 vmware
Computer type
Laptop
Manufacturer/Model
Dell
CPU
I9 13950hx
Memory
128GB
Graphics Card(s)
NVIDIA 4090
Sound Card
Realtek
To make it easier for anyone who frequently creates ISOs, I made a PowerShell script. Here’s how to use it:

1- Run this command to allow the script to execute:
Powershell:
Set-ExecutionPolicy Unrestricted

2- Save the following script as inject.ps1 (or any name you prefer) in the same folder as the UUP dump folder.
Powershell:
$inputFile = "convert-UUP.cmd"
$tempFile = "temp.cmd"
$updateWimString = ":updatewim"
$cleanupString = ":cleanup"

# Lines to add after :updatewim
$updateLine1 = "DISM /Image:C:\MountUUP /remove-package /packagename:Microsoft-Edge-WebView-FOD-Package~31bf3856ad364e35~amd64~~10.0.26100.1"
$updateLine2 = "DISM /Image:C:\MountUUP /Cleanup-Image /StartComponentCleanup /ResetBase"

# Lines to add after :cleanup
$cleanupLine1 = "DISM /Image:C:\MountUUP /remove-package /packagename:Package_for_RollupFix~31bf3856ad364e35~amd64~~26100.1742.1.10"
$cleanupLine2 = "DISM /Image:C:\MountUUP /Cleanup-Image /StartComponentCleanup /ResetBase"

Get-Content $inputFile | ForEach-Object {
    Write-Output $_
   
    # Check for :updatewim and add lines
    if ($_ -eq $updateWimString) {
        Write-Output $updateLine1
        Write-Output $updateLine2
    }
   
    # Check for :cleanup and add lines
    if ($_ -eq $cleanupString) {
        Write-Output $cleanupLine1
        Write-Output $cleanupLine2
    }
} | Set-Content $tempFile

Move-Item -Force $tempFile $inputFile


3- Open PowerShell and change the directory to your UUP dump folder. For example:
Powershell:
cd C:\UUPdump

4- Run the script by executing
Powershell:
./inject.ps1
(or the name you chose) after you start building the ISO and ensure that convert-UUP.cmd has already been downloaded. This script will automatically add the necessary lines to the appropriate location.

5- If you want to revert the execution policy back to Restricted after running your script, you can do so by running:
Powershell:
Set-ExecutionPolicy Restricted
 

My Computer My Computer

At a glance

Windows 11 vmwareI9 13950hx128GBNVIDIA 4090
OS
Windows 11 vmware
Computer type
Laptop
Manufacturer/Model
Dell
CPU
I9 13950hx
Memory
128GB
Graphics Card(s)
NVIDIA 4090
Sound Card
Realtek
I've created a new script that automates the entire process. Simply place it in the UUPDump folder and run it as outlined in my previous post. The script will initiate the building process and automatically modify the necessary files. If you'd like to see detailed information about the script's actions, you can run it with the '-verbose' parameter
Powershell:
# Set verbose preference
$VerbosePreference = "Continue"
# Define Variables
$inputFile1 = "uup_download_windows.cmd"
$inputFile2 = "convert-UUP.cmd"
$inputFile3 = "ConvertConfig.ini"
$backup2 = "$inputFile2.bak"
$backup3 = "$inputFile3.bak"
$updateWimString = ":updatewim"
$cleanupString = ":cleanup"
$updateLine1 = "DISM /Image:C:\MountUUP /remove-package /packagename:Microsoft-Edge-WebView-FOD-Package~31bf3856ad364e35~amd64~~10.0.26100.1"
$cleanupLine1 = "DISM /Image:C:\MountUUP /remove-package /packagename:Package_for_RollupFix~31bf3856ad364e35~amd64~~26100.1742.1.10"
$resetbase = "DISM /Image:C:\MountUUP /Cleanup-Image /StartComponentCleanup /ResetBase"

# Backup the original input file ConvertConfig.ini before making changes
if (Test-Path $inputFile3) {
    Move-Item -Force $inputFile3 $backup3
    Write-Verbose "Backup of $inputFile3 created as $backup3."
} else {
    Write-Verbose "Error: $inputFile1 does not exist. Cannot create backup."
    exit 1
}

# Read and modify the content in ConvertConfig.ini
$content = Get-Content -Path $backup3 -Raw -ErrorAction Stop
$content = $content -replace 'Cleanup\s*=\s*0', 'Cleanup      =1'
Set-Content -Path $inputFile3 -Value $content -ErrorAction Stop

# Start building ISO
Write-Verbose "Starting the process: $inputFile1..."
try {
    $process = Start-Process $inputFile1 -PassThru -ErrorAction Stop
    Write-Verbose "Process started successfully."
} catch {
    throw "Error: Failed to start the process. $_"
}

# Wait for 5 seconds
Start-Sleep -Seconds 5

# Check if the second input file exists, and wait if it does not
Write-Verbose "Checking for the existence of $inputFile2..."
$maxRetries = 10
$currentRetry = 0

while (-not (Test-Path $inputFile2) -and $currentRetry -lt $maxRetries) {
    # Wait another 5 seconds
    Start-Sleep -Seconds 5
    $currentRetry++
    Write-Verbose "Retrying... ($currentRetry/$maxRetries)"
}

if (-not (Test-Path $inputFile2)) {
    Write-Verbose "Error: The file '$inputFile2' was not found after $($maxRetries * 5) seconds."
    exit 1
}

Write-Verbose "$inputFile2 found. Proceeding to modify the file."

# Backup the original convert-UUP.cmd before making changes
if (Test-Path $inputFile2) {
    Move-Item -Force $inputFile2 $backup2
    Write-Verbose "Backup of $inputFile2 created as $backup2."
} else {
    Write-Verbose "Error: $inputFile2 does not exist. Cannot create backup."
    exit 1
}

# Modify the file convert-UUP.cmd
Write-Verbose "Modifying $inputFile2..."
Get-Content $backup2 | ForEach-Object {
    Write-Output $_
  
    # Check for :updatewim and add lines
    if ($_ -eq $updateWimString) {
        Write-Output $updateLine1
        Write-Output $resetbase
    }
  
    # Check for :cleanup and add lines
    if ($_ -eq $cleanupString) {
        Write-Output $cleanupLine1
        Write-Output $resetbase
    }
} | Set-Content $inputFile2

Write-Verbose "$inputFile2 modified successfully."
 

My Computer My Computer

At a glance

Windows 11 vmwareI9 13950hx128GBNVIDIA 4090
OS
Windows 11 vmware
Computer type
Laptop
Manufacturer/Model
Dell
CPU
I9 13950hx
Memory
128GB
Graphics Card(s)
NVIDIA 4090
Sound Card
Realtek
Back
Top Bottom