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 69d3f18 commit 4e817b0
Show file tree
Hide file tree
Showing 6 changed files with 106 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
11 changes: 11 additions & 0 deletions functions/private/Get-WinUtilToggleStatus.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,15 @@ Function Get-WinUtilToggleStatus {
return $false
}
}
HKLM:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\policies\\system
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
}
}

}
34 changes: 34 additions & 0 deletions functions/private/Invoke-WinUtilVerboseLogon.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
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,6 +20,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)}

}
}
65 changes: 53 additions & 12 deletions winutil.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,17 @@ Function Get-WinUtilToggleStatus {
return $false
}
}
HKLM:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\policies\\system
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 @@ -730,6 +741,40 @@ 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 @@ -1747,6 +1792,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)}

}
}
Expand Down Expand Up @@ -2783,7 +2829,13 @@ $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 @@ -6038,17 +6090,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
8 changes: 7 additions & 1 deletion xaml/inputXML.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,13 @@
<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 4e817b0

Please sign in to comment.