mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2024-11-24 11:55:31 +00:00
Compare commits
2 Commits
5c2d5fae1e
...
feff1078d8
Author | SHA1 | Date | |
---|---|---|---|
|
feff1078d8 | ||
|
a4fccd3c85 |
@ -17,27 +17,34 @@ Function Get-WinUtilToggleStatus {
|
|||||||
$ToggleSwitchReg = $sync.configs.tweaks.$ToggleSwitch.registry
|
$ToggleSwitchReg = $sync.configs.tweaks.$ToggleSwitch.registry
|
||||||
|
|
||||||
if (($ToggleSwitchReg.path -imatch "hku") -and !(Get-PSDrive -Name HKU -ErrorAction SilentlyContinue)) {
|
if (($ToggleSwitchReg.path -imatch "hku") -and !(Get-PSDrive -Name HKU -ErrorAction SilentlyContinue)) {
|
||||||
New-PSDrive -PSProvider Registry -Name HKU -Root HKEY_USERS
|
$null = New-PSDrive -PSProvider Registry -Name HKU -Root HKEY_USERS
|
||||||
write-host "Created HKU drive"
|
write-host "Created HKU drive"
|
||||||
|
if (Get-PSDrive -Name HKU -ErrorAction SilentlyContinue) {
|
||||||
|
Write-Host "HKU drive created successfully" -ForegroundColor Green
|
||||||
|
} else {
|
||||||
|
Write-Host "Failed to create HKU drive"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($ToggleSwitchReg) {
|
if ($ToggleSwitchReg) {
|
||||||
$count = 0
|
$count = 0
|
||||||
|
|
||||||
foreach ($regentry in $ToggleSwitchReg) {
|
foreach ($regentry in $ToggleSwitchReg) {
|
||||||
$regstate = (Get-ItemProperty -path $($regentry.Path)).$($regentry.Name)
|
write-host "Checking $($regentry.path)"
|
||||||
|
$regstate = (Get-ItemProperty -path $regentry.Path).$($regentry.Name)
|
||||||
if ($regstate -eq $regentry.Value) {
|
if ($regstate -eq $regentry.Value) {
|
||||||
$count += 1
|
$count += 1
|
||||||
|
write-host "$($regentry.Name) is true (state: $regstate, value: $($regentry.Value), original: $($regentry.OriginalValue))" -ForegroundColor Green
|
||||||
} else {
|
} else {
|
||||||
write-debug "$($regentry.Name) is false (state: $regstate, value: $($regentry.Value), original: $($regentry.OriginalValue))"
|
write-host "$($regentry.Name) is false (state: $regstate, value: $($regentry.Value), original: $($regentry.OriginalValue))"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($count -eq $ToggleSwitchReg.Count) {
|
if ($count -eq $ToggleSwitchReg.Count) {
|
||||||
write-debug "$($ToggleSwitchReg.Name) is true (count: $count)"
|
write-host "$($ToggleSwitchReg.Name) is true (count: $count)" -ForegroundColor Green
|
||||||
return $true
|
return $true
|
||||||
} else {
|
} else {
|
||||||
write-debug "$($ToggleSwitchReg.Name) is false (count: $count)"
|
write-host "$($ToggleSwitchReg.Name) is false (count: $count)"
|
||||||
return $false
|
return $false
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -77,9 +77,14 @@ function Invoke-WinUtilTweaks {
|
|||||||
if($sync.configs.tweaks.$CheckBox.registry) {
|
if($sync.configs.tweaks.$CheckBox.registry) {
|
||||||
$sync.configs.tweaks.$CheckBox.registry | ForEach-Object {
|
$sync.configs.tweaks.$CheckBox.registry | ForEach-Object {
|
||||||
Write-Debug "$($psitem.Name) and state is $($psitem.$($values.registry))"
|
Write-Debug "$($psitem.Name) and state is $($psitem.$($values.registry))"
|
||||||
if (($psitem.Path -imatch "hku") -and !(Get-PSDrive -Name HKU -ErrorAction SilentlyContinue)) {
|
if (($ToggleSwitchReg.path -imatch "hku") -and !(Get-PSDrive -Name HKU -ErrorAction SilentlyContinue)) {
|
||||||
New-PSDrive -PSProvider Registry -Name HKU -Root HKEY_USERS
|
New-PSDrive -PSProvider Registry -Name HKU -Root HKEY_USERS
|
||||||
write-host "Created HKU drive"
|
write-host "Created HKU drive"
|
||||||
|
if (Get-PSDrive -Name HKU -ErrorAction SilentlyContinue) {
|
||||||
|
Write-Host "HKU drive created successfully"
|
||||||
|
} else {
|
||||||
|
Write-Host "Failed to create HKU drive"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Set-WinUtilRegistry -Name $psitem.Name -Path $psitem.Path -Type $psitem.Type -Value $psitem.$($values.registry)
|
Set-WinUtilRegistry -Name $psitem.Name -Path $psitem.Path -Type $psitem.Type -Value $psitem.$($values.registry)
|
||||||
}
|
}
|
||||||
|
@ -192,7 +192,13 @@ function Invoke-WPFUIElements {
|
|||||||
|
|
||||||
$sync[$entryInfo.Name] = $checkBox
|
$sync[$entryInfo.Name] = $checkBox
|
||||||
|
|
||||||
$sync[$entryInfo.Name].IsChecked = Get-WinUtilToggleStatus $entryInfo.Name
|
$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({
|
$sync[$entryInfo.Name].Add_Checked({
|
||||||
[System.Object]$Sender = $args[0]
|
[System.Object]$Sender = $args[0]
|
||||||
|
Loading…
Reference in New Issue
Block a user