From 459d0fd1b2830d91de6df15994f96eb98262a54b Mon Sep 17 00:00:00 2001 From: Gabi <218829269+GabiNun2@users.noreply.github.com> Date: Tue, 26 May 2026 13:05:25 -0700 Subject: [PATCH] Fixed Get-WinUtilToggleStatus.ps1 displaying incorrect infromation for tweaks (#4522) * Fixed Get-WinUtilToggleStatus.ps1 displaying incorrect infromation of tweaks * Update Get-WinUtilToggleStatus.ps1 * Update Get-WinUtilToggleStatus.ps1 * Update Get-WinUtilToggleStatus.ps1 * Update Get-WinUtilToggleStatus.ps1 --- functions/private/Get-WinUtilToggleStatus.ps1 | 33 +++++-------------- 1 file changed, 8 insertions(+), 25 deletions(-) diff --git a/functions/private/Get-WinUtilToggleStatus.ps1 b/functions/private/Get-WinUtilToggleStatus.ps1 index 8053bbde..0d19e7d9 100644 --- a/functions/private/Get-WinUtilToggleStatus.ps1 +++ b/functions/private/Get-WinUtilToggleStatus.ps1 @@ -1,21 +1,12 @@ -Function Get-WinUtilToggleStatus { - param( - [string]$ToggleSwitch - ) +Function Get-WinUtilToggleStatus ($ToggleSwitch) { - $toggleSwitchReg = if ($ToggleSwitch) { - $sync.configs.tweaks.$ToggleSwitch.registry - } else { - $ToggleSwitchReg + $ToggleSwitchReg = $sync.configs.tweaks.$ToggleSwitch.registry + + if (-not (Get-PSDrive -Name HKU -ErrorAction SilentlyContinue)) { + New-PSDrive -PSProvider Registry -Name HKU -Root HKEY_USERS | Out-Null } - if (-not $toggleSwitchReg) { - return $false - } - - New-PSDrive -Name HKU -PSProvider Registry -Root HKEY_USERS - - foreach ($regentry in $toggleSwitchReg) { + foreach ($regentry in $ToggleSwitchReg) { if (-not (Test-Path $regentry.Path)) { New-Item -Path $regentry.Path -Force | Out-Null @@ -25,16 +16,8 @@ Function Get-WinUtilToggleStatus { if ($null -eq $regstate) { switch ($regentry.DefaultState) { - "true" { - $regstate = $regentry.Value - } - "false" { - $regstate = $regentry.OriginalValue - } - default { - Write-Error "Entry $($regentry.Name): missing value and no DefaultState" - $regstate = $regentry.OriginalValue - } + "true" { $regstate = $regentry.Value } + "false" { $regstate = $regentry.OriginalValue } } }