mirror of
https://github.com/ChrisTitusTech/winutil
synced 2026-06-04 14:17:27 +00:00
5aa099f6e2
* Fix product key invalid and missing metadata on some isos * Fix Gabi's broken light mode pr
48 lines
1.2 KiB
PowerShell
48 lines
1.2 KiB
PowerShell
Function Get-WinUtilToggleStatus {
|
|
param(
|
|
[string]$ToggleSwitch
|
|
)
|
|
|
|
$toggleSwitchReg = if ($ToggleSwitch) {
|
|
$sync.configs.tweaks.$ToggleSwitch.registry
|
|
} else {
|
|
$ToggleSwitchReg
|
|
}
|
|
|
|
if (-not $toggleSwitchReg) {
|
|
return $false
|
|
}
|
|
|
|
New-PSDrive -Name HKU -PSProvider Registry -Root HKEY_USERS
|
|
|
|
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
|
|
}
|
|
default {
|
|
Write-Error "Entry $($regentry.Name): missing value and no DefaultState"
|
|
$regstate = $regentry.OriginalValue
|
|
}
|
|
}
|
|
}
|
|
|
|
if ($regstate -ne $regentry.Value) {
|
|
return $false
|
|
}
|
|
}
|
|
|
|
return $true
|
|
}
|