Files
winutil/functions/private/Get-WinUtilToggleStatus.ps1
T
Gabi 459d0fd1b2 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
2026-05-26 15:05:25 -05:00

31 lines
853 B
PowerShell

Function Get-WinUtilToggleStatus ($ToggleSwitch) {
$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
}
foreach ($regentry in $ToggleSwitchReg) {
if (-not (Test-Path $regentry.Path)) {
New-Item -Path $regentry.Path -Force | Out-Null
}
$regstate = (Get-ItemProperty -Path $regentry.Path).$($regentry.Name)
if ($null -eq $regstate) {
switch ($regentry.DefaultState) {
"true" { $regstate = $regentry.Value }
"false" { $regstate = $regentry.OriginalValue }
}
}
if ($regstate -ne $regentry.Value) {
return $false
}
}
return $true
}