2026-05-26 13:05:25 -07:00
|
|
|
Function Get-WinUtilToggleStatus ($ToggleSwitch) {
|
2026-05-19 14:11:27 -05:00
|
|
|
|
2026-05-26 13:05:25 -07:00
|
|
|
$ToggleSwitchReg = $sync.configs.tweaks.$ToggleSwitch.registry
|
2023-07-27 16:06:41 -05:00
|
|
|
|
2026-05-26 13:05:25 -07:00
|
|
|
if (-not (Get-PSDrive -Name HKU -ErrorAction SilentlyContinue)) {
|
|
|
|
|
New-PSDrive -PSProvider Registry -Name HKU -Root HKEY_USERS | Out-Null
|
|
|
|
|
}
|
2023-11-14 15:45:48 -06:00
|
|
|
|
2026-05-26 13:05:25 -07: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) {
|
2026-05-26 13:05:25 -07:00
|
|
|
"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
|
|
|
|
|
}
|
2024-07-31 03:50:50 +02:00
|
|
|
}
|
2026-05-19 21:13:27 +03:00
|
|
|
|
|
|
|
|
return $true
|
2024-04-20 16:38:43 -05:00
|
|
|
}
|