Changed function name in DISM-FEATURES.ps1

This commit is contained in:
h3r0 2023-12-07 17:00:43 +00:00 committed by GitHub
parent 16fb0eaffe
commit 582eaa9f00
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 5 deletions

View File

@ -1,4 +1,4 @@
function Toggle-Feature {
function Update-Feature {
param(
[string]$featureName,
[bool]$bool
@ -9,7 +9,7 @@ function Toggle-Feature {
$dismCmd = if ($bool) { "Enable" } else { "Disable" }
if ($regKey -eq $null -or ($regKey.Selection -eq 0 -and $bool) -or ($regKey.Selection -eq 1 -and !$bool)) {
if ($null -eq $regKey -or ($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 -All
@ -20,7 +20,7 @@ function Toggle-Feature {
}
$featuresToToggle = @(
$features = @(
@{ Name = "DirectPlay"; Bool = $true },
@{ Name = "LegacyComponents"; Bool = $true },
@{ Name = "MicrosoftWindowsPowerShellV2"; Bool = $false },
@ -31,6 +31,6 @@ $featuresToToggle = @(
@{ Name = "WorkFolders-Client"; Bool = $false }
# @{ Name = "SmbDirect"; Bool = $false }
)
foreach ($feature in $featuresToToggle) {
Toggle-Feature -featureName $feature.Name -bool $feature.Bool
foreach ($feature in $features) {
Update-Feature -featureName $feature.Name -bool $feature.Bool
}