Files
winutil/functions/private/Get-WinUtilToggleStatus.ps1
T

31 lines
853 B
PowerShell
Raw Normal View History

Function Get-WinUtilToggleStatus ($ToggleSwitch) {
2026-05-19 14:11:27 -05:00
$ToggleSwitchReg = $sync.configs.tweaks.$ToggleSwitch.registry
2023-07-27 16:06:41 -05:00
if (-not (Get-PSDrive -Name HKU -ErrorAction SilentlyContinue)) {
New-PSDrive -PSProvider Registry -Name HKU -Root HKEY_USERS | Out-Null
}
+1
2023-11-14 15:45:48 -06:00
foreach ($regentry in $ToggleSwitchReg) {
2024-12-06 04:24:36 +01:00
2026-05-19 21:13:27 +03:00
if (-not (Test-Path $regentry.Path)) {
New-Item -Path $regentry.Path -Force | Out-Null
2024-12-06 04:24:36 +01:00
}
2026-05-19 21:13:27 +03:00
$regstate = (Get-ItemProperty -Path $regentry.Path).$($regentry.Name)
2024-12-06 04:24:36 +01:00
2026-05-19 21:13:27 +03:00
if ($null -eq $regstate) {
switch ($regentry.DefaultState) {
"true" { $regstate = $regentry.Value }
"false" { $regstate = $regentry.OriginalValue }
2024-12-06 04:24:36 +01:00
}
}
2026-05-19 21:13:27 +03:00
if ($regstate -ne $regentry.Value) {
2024-12-06 04:24:36 +01:00
return $false
}
}
2026-05-19 21:13:27 +03:00
return $true
+1
2024-04-20 16:38:43 -05:00
}