fix: skip features that the running Windows build does not support (#832)

This commit is contained in:
HetCreep
2026-10-18 22:23:18 +02:00
committed by GitHub
parent 94dd603da4
commit 73834839ff
13 changed files with 240 additions and 5 deletions
+15
View File
@@ -363,6 +363,21 @@ function Invoke-AllChanges {
}
$undoIds = @($script:UndoParams.Keys)
# Features passed as switches are not filtered by the GUI or the config import, so skip the ones this Windows build does not support
$currentBuild = Get-CurrentWindowsBuild
$unsupportedIds = @($applyIds | Where-Object { -not (Test-FeatureSupportedOnBuild -Feature $script:Features[$_] -Build $currentBuild) })
foreach ($id in $unsupportedIds) {
$feature = $script:Features[$id]
$range = @()
if ($feature.MinVersion) { $range += "build $($feature.MinVersion) or newer" }
if ($feature.MaxVersion) { $range += "build $($feature.MaxVersion) or older" }
Write-Warning "Skipping ${id}: it is only supported on Windows $($range -join ' and '), this system runs build $currentBuild."
# Also drop it from the parameters, so that later steps (such as the reboot advice) only see what was applied
[void]$script:Params.Remove($id)
}
$applyIds = @($applyIds | Where-Object { $unsupportedIds -notcontains $_ })
# ---- Determine if registry backup is needed ----
$needsBackup = $false
foreach ($id in $applyIds) {