mirror of
https://github.com/ChrisTitusTech/winutil
synced 2026-06-04 14:17:27 +00:00
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:
@@ -1,21 +1,12 @@
|
|||||||
Function Get-WinUtilToggleStatus {
|
Function Get-WinUtilToggleStatus ($ToggleSwitch) {
|
||||||
param(
|
|
||||||
[string]$ToggleSwitch
|
|
||||||
)
|
|
||||||
|
|
||||||
$toggleSwitchReg = if ($ToggleSwitch) {
|
$ToggleSwitchReg = $sync.configs.tweaks.$ToggleSwitch.registry
|
||||||
$sync.configs.tweaks.$ToggleSwitch.registry
|
|
||||||
} else {
|
if (-not (Get-PSDrive -Name HKU -ErrorAction SilentlyContinue)) {
|
||||||
$ToggleSwitchReg
|
New-PSDrive -PSProvider Registry -Name HKU -Root HKEY_USERS | Out-Null
|
||||||
}
|
}
|
||||||
|
|
||||||
if (-not $toggleSwitchReg) {
|
foreach ($regentry in $ToggleSwitchReg) {
|
||||||
return $false
|
|
||||||
}
|
|
||||||
|
|
||||||
New-PSDrive -Name HKU -PSProvider Registry -Root HKEY_USERS
|
|
||||||
|
|
||||||
foreach ($regentry in $toggleSwitchReg) {
|
|
||||||
|
|
||||||
if (-not (Test-Path $regentry.Path)) {
|
if (-not (Test-Path $regentry.Path)) {
|
||||||
New-Item -Path $regentry.Path -Force | Out-Null
|
New-Item -Path $regentry.Path -Force | Out-Null
|
||||||
@@ -25,16 +16,8 @@ Function Get-WinUtilToggleStatus {
|
|||||||
|
|
||||||
if ($null -eq $regstate) {
|
if ($null -eq $regstate) {
|
||||||
switch ($regentry.DefaultState) {
|
switch ($regentry.DefaultState) {
|
||||||
"true" {
|
"true" { $regstate = $regentry.Value }
|
||||||
$regstate = $regentry.Value
|
"false" { $regstate = $regentry.OriginalValue }
|
||||||
}
|
|
||||||
"false" {
|
|
||||||
$regstate = $regentry.OriginalValue
|
|
||||||
}
|
|
||||||
default {
|
|
||||||
Write-Error "Entry $($regentry.Name): missing value and no DefaultState"
|
|
||||||
$regstate = $regentry.OriginalValue
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user