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
This commit is contained in:
Gabi
2026-05-26 13:05:25 -07:00
committed by GitHub
parent 48e94f71bc
commit 459d0fd1b2
+8 -25
View File
@@ -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 }
}
}