mirror of
https://github.com/ChrisTitusTech/winutil
synced 2026-04-05 22:28:31 +00:00
This reverts commit 414cd139e2.
This commit is contained in:
@@ -45,7 +45,7 @@ Function Get-WinUtilToggleStatus {
|
||||
} else {
|
||||
Write-Debug "$($regentry.Name) is false (state: $regstate, value: $($regentry.Value), original: $($regentry.OriginalValue))"
|
||||
}
|
||||
if ($null -eq $regstate) {
|
||||
if (!$regstate) {
|
||||
switch ($regentry.DefaultState) {
|
||||
"true" {
|
||||
$regstate = $regentry.Value
|
||||
|
||||
@@ -41,73 +41,47 @@ Function Invoke-WinUtilCurrentSystem {
|
||||
}
|
||||
}
|
||||
|
||||
if ($CheckBox -eq "tweaks") {
|
||||
if($CheckBox -eq "tweaks") {
|
||||
|
||||
if (!(Test-Path 'HKU:\')) {$null = (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 {
|
||||
|
||||
$Config = $psitem.Name
|
||||
#WPFEssTweaksTele
|
||||
$entry = $sync.configs.tweaks.$Config
|
||||
$registryKeys = $entry.registry
|
||||
$scheduledtaskKeys = $entry.scheduledtask
|
||||
$serviceKeys = $entry.service
|
||||
$appxKeys = $entry.appx
|
||||
$invokeScript = $entry.InvokeScript
|
||||
$entryType = $entry.Type
|
||||
$registryKeys = $sync.configs.tweaks.$Config.registry
|
||||
$scheduledtaskKeys = $sync.configs.tweaks.$Config.scheduledtask
|
||||
$serviceKeys = $sync.configs.tweaks.$Config.service
|
||||
|
||||
if ($registryKeys -or $scheduledtaskKeys -or $serviceKeys) {
|
||||
if($registryKeys -or $scheduledtaskKeys -or $serviceKeys) {
|
||||
$Values = @()
|
||||
|
||||
if ($entryType -eq "Toggle") {
|
||||
if (-not (Get-WinUtilToggleStatus $Config)) {
|
||||
$values += $False
|
||||
}
|
||||
} else {
|
||||
$registryMatchCount = 0
|
||||
$registryTotal = 0
|
||||
|
||||
Foreach ($tweaks in $registryKeys) {
|
||||
Foreach ($tweak in $tweaks) {
|
||||
$registryTotal++
|
||||
$regstate = $null
|
||||
Foreach ($tweaks in $registryKeys) {
|
||||
Foreach($tweak in $tweaks) {
|
||||
|
||||
if (Test-Path $tweak.Path) {
|
||||
$regstate = Get-ItemProperty -Name $tweak.Name -Path $tweak.Path -ErrorAction SilentlyContinue | Select-Object -ExpandProperty $($tweak.Name)
|
||||
}
|
||||
|
||||
if ($null -eq $regstate) {
|
||||
switch ($tweak.DefaultState) {
|
||||
"true" {
|
||||
$regstate = $tweak.Value
|
||||
}
|
||||
"false" {
|
||||
$regstate = $tweak.OriginalValue
|
||||
}
|
||||
default {
|
||||
$regstate = $tweak.OriginalValue
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($regstate -eq $tweak.Value) {
|
||||
$registryMatchCount++
|
||||
if(test-path $tweak.Path) {
|
||||
$actualValue = Get-ItemProperty -Name $tweak.Name -Path $tweak.Path -ErrorAction SilentlyContinue | Select-Object -ExpandProperty $($tweak.Name)
|
||||
$expectedValue = $tweak.Value
|
||||
if ($expectedValue -eq "<RemoveEntry>") {
|
||||
if ($null -ne $actualValue) {
|
||||
$values += $False
|
||||
}
|
||||
} elseif ($expectedValue -notlike $actualValue) {
|
||||
$values += $False
|
||||
}
|
||||
} else {
|
||||
$values += $False
|
||||
}
|
||||
}
|
||||
|
||||
if ($registryTotal -gt 0 -and $registryMatchCount -ne $registryTotal) {
|
||||
$values += $False
|
||||
}
|
||||
}
|
||||
|
||||
Foreach ($tweaks in $scheduledtaskKeys) {
|
||||
Foreach ($tweak in $tweaks) {
|
||||
Foreach($tweak in $tweaks) {
|
||||
$task = $ScheduledTasks | Where-Object {$($psitem.TaskPath + $psitem.TaskName) -like "\$($tweak.name)"}
|
||||
|
||||
if ($task) {
|
||||
if($task) {
|
||||
$actualValue = $task.State
|
||||
$expectedValue = $tweak.State
|
||||
if ($expectedValue -ne $actualValue) {
|
||||
@@ -118,10 +92,10 @@ Function Invoke-WinUtilCurrentSystem {
|
||||
}
|
||||
|
||||
Foreach ($tweaks in $serviceKeys) {
|
||||
Foreach ($tweak in $tweaks) {
|
||||
Foreach($tweak in $tweaks) {
|
||||
$Service = Get-Service -Name $tweak.Name
|
||||
|
||||
if ($Service) {
|
||||
if($Service) {
|
||||
$actualValue = $Service.StartType
|
||||
$expectedValue = $tweak.StartupType
|
||||
if ($expectedValue -ne $actualValue) {
|
||||
@@ -131,13 +105,9 @@ Function Invoke-WinUtilCurrentSystem {
|
||||
}
|
||||
}
|
||||
|
||||
if ($values -notcontains $false) {
|
||||
if($values -notcontains $false) {
|
||||
Write-Output $Config
|
||||
}
|
||||
} else {
|
||||
if ($invokeScript -or $appxKeys) {
|
||||
Write-Debug "Skipping $Config in Get Installed: no detectable registry, scheduled task, or service state."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user