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

88 lines
4.2 KiB
PowerShell
Raw Normal View History

2023-07-27 16:06:41 -05:00
Function Get-WinUtilToggleStatus {
<#
2023-10-19 17:12:55 -05:00
.SYNOPSIS
Pulls the registry keys for the given toggle switch and checks whether the toggle should be checked or unchecked
.PARAMETER ToggleSwitch
The name of the toggle to check
.OUTPUTS
Boolean to set the toggle's status to
2023-07-27 16:06:41 -05:00
#>
Param($ToggleSwitch)
if($ToggleSwitch -eq "WPFToggleDarkMode") {
2023-07-27 16:06:41 -05:00
$app = (Get-ItemProperty -path 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize').AppsUseLightTheme
$system = (Get-ItemProperty -path 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize').SystemUsesLightTheme
return $app -eq 0 -and $system -eq 0
2023-07-27 16:06:41 -05:00
}
if($ToggleSwitch -eq "WPFToggleBingSearch") {
2023-07-27 16:06:41 -05:00
$bingsearch = (Get-ItemProperty -path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Search').BingSearchEnabled
return $bingsearch -ne 0
2023-07-27 16:06:41 -05:00
}
if($ToggleSwitch -eq "WPFToggleNumLock") {
+1
2023-11-14 15:45:48 -06:00
$numlockvalue = (Get-ItemProperty -path 'HKCU:\Control Panel\Keyboard').InitialKeyboardIndicators
return $numlockvalue -eq 2
+1
2023-11-14 15:45:48 -06:00
}
if($ToggleSwitch -eq "WPFToggleVerboseLogon") {
+1
2023-11-14 15:45:48 -06:00
$VerboseStatusvalue = (Get-ItemProperty -path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System').VerboseStatus
return $VerboseStatusvalue -eq 1
}
if($ToggleSwitch -eq "WPFToggleShowExt") {
+1
2023-11-14 15:45:48 -06:00
$hideextvalue = (Get-ItemProperty -path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced').HideFileExt
return $hideextvalue -eq 0
}
if($ToggleSwitch -eq "WPFToggleSnapWindow") {
+26
2024-06-04 20:27:27 -07:00
$hidesnap = (Get-ItemProperty -path 'HKCU:\Control Panel\Desktop').WindowArrangementActive
return $hidesnap -ne 0
+26
2024-06-04 20:27:27 -07:00
}
if($ToggleSwitch -eq "WPFToggleSnapFlyout") {
+5
2024-01-25 14:44:51 -06:00
$hidesnap = (Get-ItemProperty -path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced').EnableSnapAssistFlyout
return $hidesnap -ne 0
}
if($ToggleSwitch -eq "WPFToggleSnapSuggestion") {
+26
2024-06-04 20:27:27 -07:00
$hidesnap = (Get-ItemProperty -path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced').SnapAssist
return $hidesnap -ne 0
}
if($ToggleSwitch -eq "WPFToggleMouseAcceleration") {
+1
2023-11-14 15:45:48 -06:00
$MouseSpeed = (Get-ItemProperty -path 'HKCU:\Control Panel\Mouse').MouseSpeed
$MouseThreshold1 = (Get-ItemProperty -path 'HKCU:\Control Panel\Mouse').MouseThreshold1
$MouseThreshold2 = (Get-ItemProperty -path 'HKCU:\Control Panel\Mouse').MouseThreshold2
return $MouseSpeed -eq 1 -and $MouseThreshold1 -eq 6 -and $MouseThreshold2 -eq 10
+1
2023-11-14 15:45:48 -06:00
}
if($ToggleSwitch -eq "WPFToggleTaskbarSearch") {
2024-06-28 15:02:32 +00:00
$SearchButton = (Get-ItemProperty -path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Search").SearchboxTaskbarMode
return $SearchButton -ne 0
2024-06-28 15:02:32 +00:00
}
2024-02-03 11:42:14 -06:00
if ($ToggleSwitch -eq "WPFToggleStickyKeys") {
$StickyKeys = (Get-ItemProperty -path 'HKCU:\Control Panel\Accessibility\StickyKeys').Flags
return $StickyKeys -ne 58
2024-02-03 11:42:14 -06:00
}
2024-06-28 16:14:05 +01:00
if ($ToggleSwitch -eq "WPFToggleTaskView") {
$TaskView = (Get-ItemProperty -path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced').ShowTaskViewButton
return $TaskView -ne 0
2024-06-28 16:14:05 +01:00
}
2024-07-15 02:01:09 +01:00
if ($ToggleSwitch -eq "WPFToggleHiddenFiles") {
$HiddenFiles = (Get-ItemProperty -path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced').Hidden
return $HiddenFiles -ne 0
2024-07-15 02:01:09 +01:00
}
+1
2024-04-20 16:38:43 -05:00
if ($ToggleSwitch -eq "WPFToggleTaskbarWidgets") {
$TaskbarWidgets = (Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced").TaskBarDa
return $TaskbarWidgets -ne 0
}
if ($ToggleSwitch -eq "WPFToggleTaskbarAlignment") {
$TaskbarAlignment = (Get-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced").TaskbarAl
return $TaskbarAlignment -ne 0
+1
2024-04-20 16:38:43 -05:00
}
if ($ToggleSwitch -eq "WPFToggleDetailedBSoD") {
$DetailedBSoD1 = (Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\CrashControl').DisplayParameters
$DetailedBSoD2 = (Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\CrashControl').DisableEmoticon
return !(($DetailedBSoD1 -eq 0) -or ($DetailedBSoD2 -eq 0) -or !$DetailedBSoD1 -or !$DetailedBSoD2)
}
+1
2024-04-20 16:38:43 -05:00
}