mirror of
https://github.com/ChrisTitusTech/winutil
synced 2026-04-06 14:48:31 +00:00
Win11 iso (#4113)
* Tab creation * scaffold outline for the iso tab * autounattended creation * inital modification success * iso save success * cleanup and iso improvements * fix startmenu on new 26h2 * remove old first startup * Fix run for use * fix unapproved verb * Keep step 4 output expanded * update auto-merge * Cleanup * remove out-null and trailing whitespace * explain modify and creator button * fix scroll to end * remove workflow change * fix home updates
This commit is contained in:
@@ -124,7 +124,15 @@ function Invoke-WinUtilISOMountAndVerify {
|
|||||||
[void]$sync["WPFWin11ISOEditionComboBox"].Items.Add("$($img.ImageIndex): $($img.ImageName)")
|
[void]$sync["WPFWin11ISOEditionComboBox"].Items.Add("$($img.ImageIndex): $($img.ImageName)")
|
||||||
}
|
}
|
||||||
if ($sync["WPFWin11ISOEditionComboBox"].Items.Count -gt 0) {
|
if ($sync["WPFWin11ISOEditionComboBox"].Items.Count -gt 0) {
|
||||||
$sync["WPFWin11ISOEditionComboBox"].SelectedIndex = 0
|
# Default to Windows 11 Pro; fall back to first item if not found
|
||||||
|
$proIndex = -1
|
||||||
|
for ($i = 0; $i -lt $sync["WPFWin11ISOEditionComboBox"].Items.Count; $i++) {
|
||||||
|
if ($sync["WPFWin11ISOEditionComboBox"].Items[$i] -match "Windows 11 Pro(?![\w ])") {
|
||||||
|
$proIndex = $i
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$sync["WPFWin11ISOEditionComboBox"].SelectedIndex = if ($proIndex -ge 0) { $proIndex } else { 0 }
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
$sync["WPFWin11ISOVerifyResultPanel"].Visibility = "Visible"
|
$sync["WPFWin11ISOVerifyResultPanel"].Visibility = "Visible"
|
||||||
@@ -513,11 +521,17 @@ function Invoke-WinUtilISOExport {
|
|||||||
|
|
||||||
$outputISO = $dlg.FileName
|
$outputISO = $dlg.FileName
|
||||||
Write-Win11ISOLog "Exporting to ISO: $outputISO"
|
Write-Win11ISOLog "Exporting to ISO: $outputISO"
|
||||||
|
|
||||||
Set-WinUtilProgressBar -Label "Building ISO..." -Percent 10
|
Set-WinUtilProgressBar -Label "Building ISO..." -Percent 10
|
||||||
|
|
||||||
# Locate oscdimg.exe (Windows ADK)
|
# Locate oscdimg.exe (Windows ADK or winget per-user install)
|
||||||
$oscdimg = Get-ChildItem "C:\Program Files (x86)\Windows Kits" -Recurse -Filter "oscdimg.exe" -ErrorAction SilentlyContinue |
|
$oscdimg = Get-ChildItem "C:\Program Files (x86)\Windows Kits" -Recurse -Filter "oscdimg.exe" -ErrorAction SilentlyContinue |
|
||||||
Select-Object -First 1 -ExpandProperty FullName
|
Select-Object -First 1 -ExpandProperty FullName
|
||||||
|
if (-not $oscdimg) {
|
||||||
|
$oscdimg = Get-ChildItem "$env:LOCALAPPDATA\Microsoft\WinGet\Packages" -Recurse -Filter "oscdimg.exe" -ErrorAction SilentlyContinue |
|
||||||
|
Where-Object { $_.FullName -match 'Microsoft\.OSCDIMG' } |
|
||||||
|
Select-Object -First 1 -ExpandProperty FullName
|
||||||
|
}
|
||||||
|
|
||||||
if (-not $oscdimg) {
|
if (-not $oscdimg) {
|
||||||
Write-Win11ISOLog "oscdimg.exe not found. Attempting to install via winget..."
|
Write-Win11ISOLog "oscdimg.exe not found. Attempting to install via winget..."
|
||||||
@@ -526,8 +540,9 @@ function Invoke-WinUtilISOExport {
|
|||||||
$winget = Get-Command winget -ErrorAction Stop
|
$winget = Get-Command winget -ErrorAction Stop
|
||||||
$result = & $winget install -e --id Microsoft.OSCDIMG --accept-package-agreements --accept-source-agreements 2>&1
|
$result = & $winget install -e --id Microsoft.OSCDIMG --accept-package-agreements --accept-source-agreements 2>&1
|
||||||
Write-Win11ISOLog "winget output: $result"
|
Write-Win11ISOLog "winget output: $result"
|
||||||
# Re-scan for oscdimg after install
|
# Re-scan after install
|
||||||
$oscdimg = Get-ChildItem "C:\Program Files (x86)\Windows Kits" -Recurse -Filter "oscdimg.exe" -ErrorAction SilentlyContinue |
|
$oscdimg = Get-ChildItem "$env:LOCALAPPDATA\Microsoft\WinGet\Packages" -Recurse -Filter "oscdimg.exe" -ErrorAction SilentlyContinue |
|
||||||
|
Where-Object { $_.FullName -match 'Microsoft\.OSCDIMG' } |
|
||||||
Select-Object -First 1 -ExpandProperty FullName
|
Select-Object -First 1 -ExpandProperty FullName
|
||||||
} catch {
|
} catch {
|
||||||
Write-Win11ISOLog "winget not available or install failed: $_"
|
Write-Win11ISOLog "winget not available or install failed: $_"
|
||||||
@@ -559,7 +574,31 @@ function Invoke-WinUtilISOExport {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
Write-Win11ISOLog "Running oscdimg..."
|
Write-Win11ISOLog "Running oscdimg..."
|
||||||
$proc = Start-Process -FilePath $oscdimg -ArgumentList $oscdimgArgs -Wait -PassThru -NoNewWindow
|
$psi = [System.Diagnostics.ProcessStartInfo]::new()
|
||||||
|
$psi.FileName = $oscdimg
|
||||||
|
$psi.Arguments = $oscdimgArgs -join " "
|
||||||
|
$psi.RedirectStandardOutput = $true
|
||||||
|
$psi.RedirectStandardError = $true
|
||||||
|
$psi.UseShellExecute = $false
|
||||||
|
$psi.CreateNoWindow = $true
|
||||||
|
|
||||||
|
$proc = [System.Diagnostics.Process]::new()
|
||||||
|
$proc.StartInfo = $psi
|
||||||
|
$proc.Start() | Out-Null
|
||||||
|
|
||||||
|
# Stream stdout and stderr line-by-line to the status log
|
||||||
|
$stdoutTask = $proc.StandardOutput.ReadToEndAsync()
|
||||||
|
$stderrTask = $proc.StandardError.ReadToEndAsync()
|
||||||
|
$proc.WaitForExit()
|
||||||
|
[System.Threading.Tasks.Task]::WaitAll($stdoutTask, $stderrTask)
|
||||||
|
|
||||||
|
foreach ($line in ($stdoutTask.Result -split "`r?`n")) {
|
||||||
|
if ($line.Trim()) { Write-Win11ISOLog $line }
|
||||||
|
}
|
||||||
|
foreach ($line in ($stderrTask.Result -split "`r?`n")) {
|
||||||
|
if ($line.Trim()) { Write-Win11ISOLog "[stderr]$line" }
|
||||||
|
}
|
||||||
|
|
||||||
if ($proc.ExitCode -eq 0) {
|
if ($proc.ExitCode -eq 0) {
|
||||||
Set-WinUtilProgressBar -Label "ISO exported ✔" -Percent 100
|
Set-WinUtilProgressBar -Label "ISO exported ✔" -Percent 100
|
||||||
Write-Win11ISOLog "ISO exported successfully: $outputISO"
|
Write-Win11ISOLog "ISO exported successfully: $outputISO"
|
||||||
|
|||||||
@@ -120,7 +120,6 @@ function Invoke-WinUtilISOScript {
|
|||||||
'Microsoft.BingWeather',
|
'Microsoft.BingWeather',
|
||||||
'Microsoft.Copilot',
|
'Microsoft.Copilot',
|
||||||
'Microsoft.Windows.CrossDevice',
|
'Microsoft.Windows.CrossDevice',
|
||||||
'Microsoft.GamingApp',
|
|
||||||
'Microsoft.GetHelp',
|
'Microsoft.GetHelp',
|
||||||
'Microsoft.Getstarted',
|
'Microsoft.Getstarted',
|
||||||
'Microsoft.Microsoft3DViewer',
|
'Microsoft.Microsoft3DViewer',
|
||||||
@@ -279,7 +278,18 @@ function Invoke-WinUtilISOScript {
|
|||||||
|
|
||||||
& $Log "Disabling Windows Update during OOBE (re-enabled on first logon via FirstLogon.ps1)..."
|
& $Log "Disabling Windows Update during OOBE (re-enabled on first logon via FirstLogon.ps1)..."
|
||||||
Set-ISOScriptReg 'HKLM\zSOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU' 'NoAutoUpdate' 'REG_DWORD' '1'
|
Set-ISOScriptReg 'HKLM\zSOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU' 'NoAutoUpdate' 'REG_DWORD' '1'
|
||||||
|
Set-ISOScriptReg 'HKLM\zSOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU' 'AUOptions' 'REG_DWORD' '1'
|
||||||
|
Set-ISOScriptReg 'HKLM\zSOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU' 'UseWUServer' 'REG_DWORD' '1'
|
||||||
Set-ISOScriptReg 'HKLM\zSOFTWARE\Policies\Microsoft\Windows\WindowsUpdate' 'DisableWindowsUpdateAccess' 'REG_DWORD' '1'
|
Set-ISOScriptReg 'HKLM\zSOFTWARE\Policies\Microsoft\Windows\WindowsUpdate' 'DisableWindowsUpdateAccess' 'REG_DWORD' '1'
|
||||||
|
Set-ISOScriptReg 'HKLM\zSOFTWARE\Policies\Microsoft\Windows\WindowsUpdate' 'WUServer' 'REG_SZ' 'http://localhost:8080'
|
||||||
|
Set-ISOScriptReg 'HKLM\zSOFTWARE\Policies\Microsoft\Windows\WindowsUpdate' 'WUStatusServer' 'REG_SZ' 'http://localhost:8080'
|
||||||
|
Set-ISOScriptReg 'HKLM\zSOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Orchestrator\UScheduler_Oobe\WindowsUpdate' 'workCompleted' 'REG_DWORD' '1'
|
||||||
|
Remove-ISOScriptReg 'HKLM\zSOFTWARE\Microsoft\WindowsUpdate\Orchestrator\UScheduler_Oobe\WindowsUpdate'
|
||||||
|
Set-ISOScriptReg 'HKLM\zSOFTWARE\Microsoft\Windows\CurrentVersion\DeliveryOptimization\Config' 'DODownloadMode' 'REG_DWORD' '0'
|
||||||
|
Set-ISOScriptReg 'HKLM\zSYSTEM\ControlSet001\Services\BITS' 'Start' 'REG_DWORD' '4'
|
||||||
|
Set-ISOScriptReg 'HKLM\zSYSTEM\ControlSet001\Services\wuauserv' 'Start' 'REG_DWORD' '4'
|
||||||
|
Set-ISOScriptReg 'HKLM\zSYSTEM\ControlSet001\Services\UsoSvc' 'Start' 'REG_DWORD' '4'
|
||||||
|
Set-ISOScriptReg 'HKLM\zSYSTEM\ControlSet001\Services\WaaSMedicSvc' 'Start' 'REG_DWORD' '4'
|
||||||
|
|
||||||
& $Log "Preventing installation of Teams..."
|
& $Log "Preventing installation of Teams..."
|
||||||
Set-ISOScriptReg 'HKLM\zSOFTWARE\Policies\Microsoft\Teams' 'DisableInstallation' 'REG_DWORD' '1'
|
Set-ISOScriptReg 'HKLM\zSOFTWARE\Policies\Microsoft\Teams' 'DisableInstallation' 'REG_DWORD' '1'
|
||||||
@@ -305,6 +315,12 @@ function Invoke-WinUtilISOScript {
|
|||||||
Remove-Item "$tasksPath\Microsoft\Windows\Application Experience\ProgramDataUpdater" -Force -ErrorAction SilentlyContinue
|
Remove-Item "$tasksPath\Microsoft\Windows\Application Experience\ProgramDataUpdater" -Force -ErrorAction SilentlyContinue
|
||||||
Remove-Item "$tasksPath\Microsoft\Windows\Chkdsk\Proxy" -Force -ErrorAction SilentlyContinue
|
Remove-Item "$tasksPath\Microsoft\Windows\Chkdsk\Proxy" -Force -ErrorAction SilentlyContinue
|
||||||
Remove-Item "$tasksPath\Microsoft\Windows\Windows Error Reporting\QueueReporting" -Force -ErrorAction SilentlyContinue
|
Remove-Item "$tasksPath\Microsoft\Windows\Windows Error Reporting\QueueReporting" -Force -ErrorAction SilentlyContinue
|
||||||
|
Remove-Item "$tasksPath\Microsoft\Windows\InstallService" -Recurse -Force -ErrorAction SilentlyContinue
|
||||||
|
Remove-Item "$tasksPath\Microsoft\Windows\UpdateOrchestrator" -Recurse -Force -ErrorAction SilentlyContinue
|
||||||
|
Remove-Item "$tasksPath\Microsoft\Windows\UpdateAssistant" -Recurse -Force -ErrorAction SilentlyContinue
|
||||||
|
Remove-Item "$tasksPath\Microsoft\Windows\WaaSMedic" -Recurse -Force -ErrorAction SilentlyContinue
|
||||||
|
Remove-Item "$tasksPath\Microsoft\Windows\WindowsUpdate" -Recurse -Force -ErrorAction SilentlyContinue
|
||||||
|
Remove-Item "$tasksPath\Microsoft\WindowsUpdate" -Recurse -Force -ErrorAction SilentlyContinue
|
||||||
|
|
||||||
& $Log "Scheduled task files deleted."
|
& $Log "Scheduled task files deleted."
|
||||||
|
|
||||||
|
|||||||
@@ -450,7 +450,16 @@ $scripts = @(
|
|||||||
};
|
};
|
||||||
{
|
{
|
||||||
reg.exe delete "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" /v NoAutoUpdate /f;
|
reg.exe delete "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" /v NoAutoUpdate /f;
|
||||||
|
reg.exe delete "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" /v AUOptions /f;
|
||||||
|
reg.exe delete "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" /v UseWUServer /f;
|
||||||
reg.exe delete "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v DisableWindowsUpdateAccess /f;
|
reg.exe delete "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v DisableWindowsUpdateAccess /f;
|
||||||
|
reg.exe delete "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v WUServer /f;
|
||||||
|
reg.exe delete "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v WUStatusServer /f;
|
||||||
|
reg.exe delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\DeliveryOptimization\Config" /v DODownloadMode /f;
|
||||||
|
reg.exe add "HKLM\SYSTEM\CurrentControlSet\Services\BITS" /v Start /t REG_DWORD /d 3 /f;
|
||||||
|
reg.exe add "HKLM\SYSTEM\CurrentControlSet\Services\wuauserv" /v Start /t REG_DWORD /d 3 /f;
|
||||||
|
reg.exe add "HKLM\SYSTEM\CurrentControlSet\Services\UsoSvc" /v Start /t REG_DWORD /d 2 /f;
|
||||||
|
reg.exe add "HKLM\SYSTEM\CurrentControlSet\Services\WaaSMedicSvc" /v Start /t REG_DWORD /d 3 /f;
|
||||||
};
|
};
|
||||||
{
|
{
|
||||||
$recallFeature = Get-WindowsOptionalFeature -Online -ErrorAction SilentlyContinue | Where-Object { $_.State -eq 'Enabled' -and $_.FeatureName -like 'Recall' };
|
$recallFeature = Get-WindowsOptionalFeature -Online -ErrorAction SilentlyContinue | Where-Object { $_.State -eq 'Enabled' -and $_.FeatureName -like 'Recall' };
|
||||||
|
|||||||
Reference in New Issue
Block a user