parent
34f3b09d02
commit
6c281ffa1d
|
@ -9,17 +9,13 @@ function Toggle-Feature {
|
|||
|
||||
$dismCmd = if ($bool) { "Enable" } else { "Disable" }
|
||||
|
||||
if ($regKey -eq $null) {
|
||||
if ($regKey -eq $null -or ($regKey.Selection -eq 0 -and $bool) -or ($regKey.Selection -eq 1 -and !$bool)) {
|
||||
Write-Host "$dismCmd $featureName"
|
||||
} else {
|
||||
if (($regKey.Selection -eq 0 -and $bool) -or ($regKey.Selection -eq 1 -and !$bool)) {
|
||||
Write-Host "$dismCmd $featureName"
|
||||
if ($bool) {
|
||||
Enable-WindowsOptionalFeature -Online -FeatureName $featureName -NoRestart
|
||||
} else {
|
||||
Disable-WindowsOptionalFeature -Online -FeatureName $featureName -NoRestart
|
||||
}
|
||||
}
|
||||
if ($bool) {
|
||||
Enable-WindowsOptionalFeature -Online -FeatureName $featureName -NoRestart
|
||||
} else {
|
||||
Disable-WindowsOptionalFeature -Online -FeatureName $featureName -NoRestart
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue