Files
Win11Debloat/Scripts/Helpers/GetUndoFeatureForParam.ps1

18 lines
445 B
PowerShell

# Returns the feature metadata for a parameter when it supports undo; otherwise returns $null.
function GetUndoFeatureForParam {
param (
[string]$paramKey
)
if (-not $script:Features -or -not $script:Features.ContainsKey($paramKey)) {
return $null
}
$feature = $script:Features[$paramKey]
if (-not ($feature.RegistryUndoKey -and $feature.UndoAction)) {
return $null
}
return $feature
}