mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2024-12-24 06:51:30 -06:00
globally fix HKU error & minimize console feedback
- fix HKU issue globally - remove some console logs, change some others to write-debug
This commit is contained in:
parent
feff1078d8
commit
667d96c397
@ -17,12 +17,11 @@ Function Get-WinUtilToggleStatus {
|
||||
$ToggleSwitchReg = $sync.configs.tweaks.$ToggleSwitch.registry
|
||||
|
||||
if (($ToggleSwitchReg.path -imatch "hku") -and !(Get-PSDrive -Name HKU -ErrorAction SilentlyContinue)) {
|
||||
$null = New-PSDrive -PSProvider Registry -Name HKU -Root HKEY_USERS
|
||||
write-host "Created HKU drive"
|
||||
$null = (New-PSDrive -PSProvider Registry -Name HKU -Root HKEY_USERS)
|
||||
if (Get-PSDrive -Name HKU -ErrorAction SilentlyContinue) {
|
||||
Write-Host "HKU drive created successfully" -ForegroundColor Green
|
||||
Write-Debug "HKU drive created successfully"
|
||||
} else {
|
||||
Write-Host "Failed to create HKU drive"
|
||||
Write-Debug "Failed to create HKU drive"
|
||||
}
|
||||
}
|
||||
|
||||
@ -30,21 +29,20 @@ Function Get-WinUtilToggleStatus {
|
||||
$count = 0
|
||||
|
||||
foreach ($regentry in $ToggleSwitchReg) {
|
||||
write-host "Checking $($regentry.path)"
|
||||
$regstate = (Get-ItemProperty -path $regentry.Path).$($regentry.Name)
|
||||
if ($regstate -eq $regentry.Value) {
|
||||
$count += 1
|
||||
write-host "$($regentry.Name) is true (state: $regstate, value: $($regentry.Value), original: $($regentry.OriginalValue))" -ForegroundColor Green
|
||||
Write-Debug "$($regentry.Name) is true (state: $regstate, value: $($regentry.Value), original: $($regentry.OriginalValue))"
|
||||
} else {
|
||||
write-host "$($regentry.Name) is false (state: $regstate, value: $($regentry.Value), original: $($regentry.OriginalValue))"
|
||||
Write-Debug "$($regentry.Name) is false (state: $regstate, value: $($regentry.Value), original: $($regentry.OriginalValue))"
|
||||
}
|
||||
}
|
||||
|
||||
if ($count -eq $ToggleSwitchReg.Count) {
|
||||
write-host "$($ToggleSwitchReg.Name) is true (count: $count)" -ForegroundColor Green
|
||||
Write-Debug "$($ToggleSwitchReg.Name) is true (count: $count)"
|
||||
return $true
|
||||
} else {
|
||||
write-host "$($ToggleSwitchReg.Name) is false (count: $count)"
|
||||
Write-Debug "$($ToggleSwitchReg.Name) is false (count: $count)"
|
||||
return $false
|
||||
}
|
||||
} else {
|
||||
|
@ -43,7 +43,7 @@ Function Invoke-WinUtilCurrentSystem {
|
||||
|
||||
if($CheckBox -eq "tweaks") {
|
||||
|
||||
if(!(Test-Path 'HKU:\')) {New-PSDrive -PSProvider Registry -Name HKU -Root HKEY_USERS}
|
||||
if(!(Test-Path 'HKU:\')) {$null = (New-PSDrive -PSProvider Registry -Name HKU -Root HKEY_USERS)}
|
||||
$ScheduledTasks = Get-ScheduledTask
|
||||
|
||||
$sync.configs.tweaks | Get-Member -MemberType NoteProperty | ForEach-Object {
|
||||
|
@ -77,13 +77,12 @@ function Invoke-WinUtilTweaks {
|
||||
if($sync.configs.tweaks.$CheckBox.registry) {
|
||||
$sync.configs.tweaks.$CheckBox.registry | ForEach-Object {
|
||||
Write-Debug "$($psitem.Name) and state is $($psitem.$($values.registry))"
|
||||
if (($ToggleSwitchReg.path -imatch "hku") -and !(Get-PSDrive -Name HKU -ErrorAction SilentlyContinue)) {
|
||||
New-PSDrive -PSProvider Registry -Name HKU -Root HKEY_USERS
|
||||
write-host "Created HKU drive"
|
||||
if (($psitem.Path -imatch "hku") -and !(Get-PSDrive -Name HKU -ErrorAction SilentlyContinue)) {
|
||||
$null = (New-PSDrive -PSProvider Registry -Name HKU -Root HKEY_USERS)
|
||||
if (Get-PSDrive -Name HKU -ErrorAction SilentlyContinue) {
|
||||
Write-Host "HKU drive created successfully"
|
||||
Write-Debug "HKU drive created successfully"
|
||||
} else {
|
||||
Write-Host "Failed to create HKU drive"
|
||||
Write-Debug "Failed to create HKU drive"
|
||||
}
|
||||
}
|
||||
Set-WinUtilRegistry -Name $psitem.Name -Path $psitem.Path -Type $psitem.Type -Value $psitem.$($values.registry)
|
||||
|
@ -194,12 +194,6 @@ function Invoke-WPFUIElements {
|
||||
|
||||
$sync[$entryInfo.Name].IsChecked = (Get-WinUtilToggleStatus $entryInfo.Name)
|
||||
|
||||
if ($sync[$entryInfo.Name].IsChecked) {
|
||||
write-host "$($entryInfo.Name) is checked" -ForegroundColor Blue
|
||||
} else {
|
||||
write-host "$($entryInfo.Name) is not checked" -ForegroundColor Red
|
||||
}
|
||||
|
||||
$sync[$entryInfo.Name].Add_Checked({
|
||||
[System.Object]$Sender = $args[0]
|
||||
Invoke-WinUtilTweaks $sender.name
|
||||
|
Loading…
Reference in New Issue
Block a user