Skip to content

Commit

Permalink
convert verboselogon checkbox into toggle button
Browse files Browse the repository at this point in the history
  • Loading branch information
padsalatushal committed Nov 7, 2023
1 parent 81fb832 commit dfb75e1
Show file tree
Hide file tree
Showing 6 changed files with 94 additions and 24 deletions.
11 changes: 0 additions & 11 deletions config/tweaks.json
Original file line number Diff line number Diff line change
Expand Up @@ -2355,17 +2355,6 @@
}
]
},
"WPFMiscTweaksEnableVerboselogon": {
"registry": [
{
"Path": "HKLM:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\policies\\system",
"OriginalValue": "0",
"Name": "VerboseStatus",
"Value": "1",
"Type": "DWord"
}
]
},
"WPFEssTweaksDeleteTempFiles": {
"InvokeScript": [
"Get-ChildItem -Path \"C:\\Windows\\Temp\" *.* -Recurse | Remove-Item -Force -Recurse
Expand Down
9 changes: 9 additions & 0 deletions functions/private/Get-WinUtilToggleStatus.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,14 @@ Function Get-WinUtilToggleStatus {
else{
return $false
}
}
if($ToggleSwitch -eq "WPFToggleVerboseLogon"){
$VerboseStatusvalue = (Get-ItemProperty -path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System').VerboseStatus
if($VerboseStatusvalue -eq 1){
return $true
}
else{
return $false
}
}
}
31 changes: 31 additions & 0 deletions functions/private/Invoke-WinUtilVerboseLogon.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
function Invoke-WinUtilVerboseLogon {
<#
.SYNOPSIS
Disables/Enables VerboseLogon Messages
.PARAMETER Enabled
Indicates whether to enable or disable VerboseLogon messages
#>
Param($Enabled)
Try{
if ($Enabled -eq $false){
Write-Host "Enabling Verbose Logon Messages"
$value = 1
}
else {
Write-Host "Disabling Verbose Logon Messages"
$value = 0
}
$Path = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System"
Set-ItemProperty -Path $Path -Name VerboseStatus -Value $value
}
Catch [System.Security.SecurityException] {
Write-Warning "Unable to set $Path\$Name to $Value due to a Security Exception"
}
Catch [System.Management.Automation.ItemNotFoundException] {
Write-Warning $psitem.Exception.ErrorRecord
}
Catch{
Write-Warning "Unable to set $Name due to unhandled exception"
Write-Warning $psitem.Exception.StackTrace
}
}
1 change: 1 addition & 0 deletions functions/public/Invoke-WPFToggle.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,6 @@ function Invoke-WPFToggle {
"WPFToggleDarkMode" {Invoke-WinUtilDarkMode -DarkMoveEnabled $(Get-WinUtilToggleStatus WPFToggleDarkMode)}
"WPFToggleBingSearch" {Invoke-WinUtilBingSearch $(Get-WinUtilToggleStatus WPFToggleBingSearch)}
"WPFToggleNumLock" {Invoke-WinUtilNumLock $(Get-WinUtilToggleStatus WPFToggleNumLock)}
"WPFToggleVerboseLogon" {Invoke-WinUtilVerboseLogon $(Get-WinUtilToggleStatus WPFToggleVerboseLogon)}
}
}
59 changes: 47 additions & 12 deletions winutil.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,15 @@ Function Get-WinUtilToggleStatus {
else{
return $false
}
}
if($ToggleSwitch -eq "WPFToggleVerboseLogon"){
$VerboseStatusvalue = (Get-ItemProperty -path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System').VerboseStatus
if($VerboseStatusvalue -eq 1){
return $true
}
else{
return $false
}
}
}
function Get-WinUtilVariables {
Expand Down Expand Up @@ -727,6 +736,37 @@ function Invoke-WinUtilTweaks {

}
}
function Invoke-WinUtilVerboseLogon {
<#
.SYNOPSIS
Disables/Enables VerboseLogon Messages
.PARAMETER Enabled
Indicates whether to enable or disable VerboseLogon messages
#>
Param($Enabled)
Try{
if ($Enabled -eq $false){
Write-Host "Enabling Verbose Logon Messages"
$value = 1
}
else {
Write-Host "Disabling Verbose Logon Messages"
$value = 0
}
$Path = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System"
Set-ItemProperty -Path $Path -Name VerboseStatus -Value $value
}
Catch [System.Security.SecurityException] {
Write-Warning "Unable to set $Path\$Name to $Value due to a Security Exception"
}
Catch [System.Management.Automation.ItemNotFoundException] {
Write-Warning $psitem.Exception.ErrorRecord
}
Catch{
Write-Warning "Unable to set $Name due to unhandled exception"
Write-Warning $psitem.Exception.StackTrace
}
}
function Remove-WinUtilAPPX {
<#
Expand Down Expand Up @@ -1744,6 +1784,7 @@ function Invoke-WPFToggle {
"WPFToggleDarkMode" {Invoke-WinUtilDarkMode -DarkMoveEnabled $(Get-WinUtilToggleStatus WPFToggleDarkMode)}
"WPFToggleBingSearch" {Invoke-WinUtilBingSearch $(Get-WinUtilToggleStatus WPFToggleBingSearch)}
"WPFToggleNumLock" {Invoke-WinUtilNumLock $(Get-WinUtilToggleStatus WPFToggleNumLock)}
"WPFToggleVerboseLogon" {Invoke-WinUtilVerboseLogon $(Get-WinUtilToggleStatus WPFToggleVerboseLogon)}
}
}
function Invoke-WPFtweaksbutton {
Expand Down Expand Up @@ -2778,7 +2819,12 @@ $inputXML = '<Window x:Class="WinUtility.MainWindow"
<CheckBox Name="WPFMiscTweaksRightClickMenu" Content="Set Classic Right-Click Menu " Margin="5,0" ToolTip="Great Windows 11 tweak to bring back good context menus when right clicking things in explorer."/>
<CheckBox Name="WPFMiscTweaksDisableMouseAcceleration" Content="Disable Mouse Acceleration" Margin="5,0" ToolTip="Disables Mouse Acceleration."/>
<CheckBox Name="WPFMiscTweaksEnableMouseAcceleration" Content="Enable Mouse Acceleration" Margin="5,0" ToolTip="Enables Mouse Acceleration."/>
<CheckBox Name="WPFMiscTweaksEnableVerboselogon" Content="Enable Verbose logon messages" Margin="5,0" ToolTip="Enables verbose logon messages."/>
<Label Content="Verbose Logon Messages" />
<StackPanel Orientation="Horizontal">
<Label Content="Disable" />
<CheckBox Name="WPFToggleVerboseLogon" Style="{StaticResource ToggleSwitchStyle}" Margin="2.5,0"/>
<Label Content="Enable" />
</StackPanel>
<CheckBox Name="WPFMiscTweaksDisableipsix" Content="Disable IPv6" Margin="5,0" ToolTip="Disables IPv6."/>
<CheckBox Name="WPFMiscTweaksEnableipsix" Content="Enable IPv6" Margin="5,0" ToolTip="Enables IPv6."/>
Expand Down Expand Up @@ -6033,17 +6079,6 @@ $sync.configs.tweaks = '{
}
]
},
"WPFMiscTweaksEnableVerboselogon": {
"registry": [
{
"Path": "HKLM:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\policies\\system",
"OriginalValue": "0",
"Name": "VerboseStatus",
"Value": "1",
"Type": "DWord"
}
]
},
"WPFEssTweaksDeleteTempFiles": {
"InvokeScript": [
"Get-ChildItem -Path \"C:\\Windows\\Temp\" *.* -Recurse | Remove-Item -Force -Recurse
Expand Down
7 changes: 6 additions & 1 deletion xaml/inputXML.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,12 @@
<CheckBox Name="WPFMiscTweaksRightClickMenu" Content="Set Classic Right-Click Menu " Margin="5,0" ToolTip="Great Windows 11 tweak to bring back good context menus when right clicking things in explorer."/>
<CheckBox Name="WPFMiscTweaksDisableMouseAcceleration" Content="Disable Mouse Acceleration" Margin="5,0" ToolTip="Disables Mouse Acceleration."/>
<CheckBox Name="WPFMiscTweaksEnableMouseAcceleration" Content="Enable Mouse Acceleration" Margin="5,0" ToolTip="Enables Mouse Acceleration."/>
<CheckBox Name="WPFMiscTweaksEnableVerboselogon" Content="Enable Verbose logon messages" Margin="5,0" ToolTip="Enables verbose logon messages."/>
<Label Content="Verbose Logon Messages" />
<StackPanel Orientation="Horizontal">
<Label Content="Disable" />
<CheckBox Name="WPFToggleVerboseLogon" Style="{StaticResource ToggleSwitchStyle}" Margin="2.5,0"/>
<Label Content="Enable" />
</StackPanel>
<CheckBox Name="WPFMiscTweaksDisableipsix" Content="Disable IPv6" Margin="5,0" ToolTip="Disables IPv6."/>
<CheckBox Name="WPFMiscTweaksEnableipsix" Content="Enable IPv6" Margin="5,0" ToolTip="Enables IPv6."/>

Expand Down

0 comments on commit dfb75e1

Please sign in to comment.