Add DisableWhenApplied property to features and update UI control states accordingly

This commit is contained in:
Jeffrey
2026-05-30 21:23:45 +02:00
parent 4332eaa833
commit 1ed967b9d3
3 changed files with 37 additions and 5 deletions

View File

@@ -28,6 +28,23 @@ function Test-FeatureApplied {
$feature = $script:Features[$FeatureId]
switch ($FeatureId) {
'DisableWidgets' {
# Widgets packages cannot be reinstalled automatically, so we treat their
# absence as the applied state (checked) and presence as not-yet-applied.
$widgetAppIds = @(
'Microsoft.StartExperiencesApp',
'MicrosoftWindows.Client.WebExperience',
'Microsoft.WidgetsPlatformRuntime'
)
foreach ($appId in $widgetAppIds) {
if (Get-AppxPackage -Name $appId -AllUsers -ErrorAction SilentlyContinue) {
return $false
}
}
return $true
}
'DisableStoreSearchSuggestions' {
if ($script:Params.ContainsKey('Sysprep')) {
return (Test-StoreSearchSuggestionsDisabledForAllUsers)