# If the script is modified, save it with UTF-8 BOM encoding.
# Script for Provisioning AppxBundle and Dependencies
# Run this script in PowerShell (as Administrator) in Audit Mode.
# =========================================================================
# --- 1. Defining Paths (Verify that all files are present in C:\) ---
# Main Appx Bundle
$AppxBundlePath = "C:\Ookla.SpeedtestbyOokla_1.18.194.0_neutral_~_43tkc6nmykmb6.AppxBundle"
# x64 dependencies (Framework, Runtime, VCLibs)
$DependencyPath1_x64 = "C:\Microsoft.NET.Native.Framework.1.7_1.7.27413.0_x64__8wekyb3d8bbwe.Appx"
$DependencyPath2_x64 = "C:\Microsoft.NET.Native.Runtime.1.7_1.7.27422.0_x64__8wekyb3d8bbwe.Appx"
$DependencyPath3_x64 = "C:\Microsoft.VCLibs.140.00_14.0.33519.0_x64__8wekyb3d8bbwe.Appx"
# x86 dependencies (Framework, Runtime, VCLibs)
$DependencyPath4_x86 = "C:\Microsoft.NET.Native.Framework.1.7_1.7.27413.0_x86__8wekyb3d8bbwe.Appx"
$DependencyPath5_x86 = "C:\Microsoft.NET.Native.Runtime.1.7_1.7.27422.0_x86__8wekyb3d8bbwe.Appx"
$DependencyPath6_x86 = "C:\Microsoft.VCLibs.140.00_14.0.33519.0_x86__8wekyb3d8bbwe.Appx"
# --- 2. Running DISM Provisioning (Enhanced Syntax) ---
Write-Host "Start DISM Provisioning for Ookla Speedtest..." -ForegroundColor Yellow
# Direct execution of DISM.EXE in PowerShell.
DISM.EXE /Online /Add-ProvisionedAppxPackage /PackagePath:"$AppxBundlePath" /SkipLicense /Region:all /DependencyPackagePath:"$DependencyPath1_x64" /DependencyPackagePath:"$DependencyPath2_x64" /DependencyPackagePath:"$DependencyPath3_x64" /DependencyPackagePath:"$DependencyPath4_x86" /DependencyPackagePath:"$DependencyPath5_x86" /DependencyPackagePath:"$DependencyPath6_x86"
if ($LASTEXITCODE -eq 0) {
Write-Host "✅ DISM provisioning completed successfully." -ForegroundColor Green
} else {
Write-Error "❌ Critical error during DISM provisioning. Exit code: $LASTEXITCODE. Check the DISM logs and file paths."
Exit 1
}
# --- 3. Cleaning Installation User Audit ---
Write-Host "Removal of any previous installations by the user Audit..." -ForegroundColor Yellow
Get-AppxPackage -AllUsers | Where-Object {$_.Name -like "*Ookla*"} | Remove-AppxPackage -ErrorAction SilentlyContinue
# --- 4. Final Provisioning Check ---
Write-Host "Verifying the package added to the image..." -ForegroundColor Yellow
$Check = Get-AppxProvisionedPackage -Online | Where-Object {$_.PackageName -like "*Ookla*"}
if ($Check) {
Write-Host "=== ✅ VERIFICATION COMPLETED: The Ookla Speedtest package is provisioned correctly. ===" -ForegroundColor Green
$Check | Format-List DisplayName, PackageName, Architecture
} else {
Write-Error "!!! ❌ ERROR: The Ookla package is not provisioned. Check the DISM logs. !!!"
Exit 1
}
Write-Host "PROCEDURE COMPLETED. You can now run Sysprep." -ForegroundColor Cyan