From 457f1820c4db788f173084e6b0195bfad4b317b7 Mon Sep 17 00:00:00 2001 From: Chris Titus Date: Tue, 10 Feb 2026 13:33:07 -0600 Subject: [PATCH] Revert "Fix Get Installed toggle detection and multiple config bugs (#3959)" (#4016) This reverts commit 414cd139e2499272ada8bb04dc7d4ed3dec8eb9c. --- config/applications.json | 2 +- config/tweaks.json | 35 ++++----- functions/private/Get-WinUtilToggleStatus.ps1 | 2 +- .../private/Invoke-WinUtilCurrentSystem.ps1 | 78 ++++++------------- 4 files changed, 41 insertions(+), 76 deletions(-) diff --git a/config/applications.json b/config/applications.json index 59bf5f1e..b43b7be1 100644 --- a/config/applications.json +++ b/config/applications.json @@ -555,7 +555,7 @@ "ffmpeg": { "category": "Utilities", "choco": "na", - "content": "FFmpeg Batch AV Converter", + "content": "eibol.FFmpegBatchAVConverter", "description": "FFmpeg Batch AV Converter is a universal audio and video encoder, that allows to use the full potential of ffmpeg command line with a few mouse clicks in a convenient GUI with drag and drop, progress information.", "link": "https://ffmpeg-batch.sourceforge.io/", "winget": "eibol.FFmpegBatchAVConverter" diff --git a/config/tweaks.json b/config/tweaks.json index 823342b3..c35c1240 100644 --- a/config/tweaks.json +++ b/config/tweaks.json @@ -665,7 +665,7 @@ }, { "Name": "TermService", - "StartupType": "Manual", + "StartupType": "Automatic", "OriginalType": "Manual" }, { @@ -725,7 +725,7 @@ }, { "Name": "VaultSvc", - "StartupType": "Manual", + "StartupType": "Automatic", "OriginalType": "Manual" }, { @@ -1632,7 +1632,7 @@ { "Path": "HKLM:\\SYSTEM\\CurrentControlSet\\Control\\TimeZoneInformation", "Name": "RealTimeIsUniversal", - "Type": "DWord", + "Type": "QWord", "Value": "1", "OriginalValue": "0" } @@ -1655,16 +1655,12 @@ # Some of OneDrive files use explorer, and OneDrive uses FileCoAuth Write-Host \"Removing leftover OneDrive Files...\" - Stop-Process -Name FileCoAuth -ErrorAction SilentlyContinue - Remove-Item \"$Env:LocalAppData\\Microsoft\\OneDrive\" -Recurse -Force -ErrorAction SilentlyContinue - Remove-Item \"C:\\ProgramData\\Microsoft OneDrive\" -Recurse -Force -ErrorAction SilentlyContinue + Stop-Process -Name FileCoAuth,Explorer + Remove-Item \"$Env:LocalAppData\\Microsoft\\OneDrive\" -Recurse -Force + Remove-Item \"C:\\ProgramData\\Microsoft OneDrive\" -Recurse -Force - # Restart Explorer - Start-Process explorer.exe - - # Reset and grant full control permissions to OneDrive folder - icacls $Env:OneDrive /reset - icacls $Env:OneDrive /grant \"Administrators:(F)\" + # Grant back permission to accses OneDrive folder + icacls $Env:OneDrive /grant \"Administrators:(D,DC)\" " ], "UndoScript": [ @@ -1680,7 +1676,7 @@ "Description": "Removes the Home from Explorer and sets This PC as default", "category": "z__Advanced Tweaks - CAUTION", "panel": "1", - "Order": "a029a_", + "Order": "a029_", "InvokeScript": [ " Remove-Item \"HKLM:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Desktop\\NameSpace\\{f874310e-b6b7-47dc-bc84-b9e6b38f5903}\" @@ -1700,7 +1696,7 @@ "Description": "Removes the Gallery from Explorer and sets This PC as default", "category": "z__Advanced Tweaks - CAUTION", "panel": "1", - "Order": "a030_", + "Order": "a029_", "InvokeScript": [ " Remove-Item \"HKLM:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Desktop\\NameSpace\\{e88865ea-0e1c-4e20-9aa6-edcd0212c87c}\" @@ -2047,12 +2043,11 @@ Get-AppxPackage -AllUsers *Copilot* | Remove-AppxPackage -AllUsers Get-AppxPackage -AllUsers Microsoft.MicrosoftOfficeHub | Remove-AppxPackage -AllUsers - $Appx = (Get-AppxPackage *MicrosoftWindows.Client.CoreAI*).PackageFullName - if ($Appx) { - $Sid = (Get-LocalUser $Env:UserName).Sid.Value - New-Item \"HKLM:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Appx\\AppxAllUserStore\\EndOfLife\\$Sid\\$Appx\" -Force - Remove-AppxPackage $Appx - } + $Appx = (Get-AppxPackage MicrosoftWindows.Client.CoreAI).PackageFullName + $Sid = (Get-LocalUser $Env:UserName).Sid.Value + + New-Item \"HKLM:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Appx\\AppxAllUserStore\\EndOfLife\\$Sid\\$Appx\" -Force + Remove-AppxPackage $Appx " ], "UndoScript": [ diff --git a/functions/private/Get-WinUtilToggleStatus.ps1 b/functions/private/Get-WinUtilToggleStatus.ps1 index 135754fb..a19dbf9b 100644 --- a/functions/private/Get-WinUtilToggleStatus.ps1 +++ b/functions/private/Get-WinUtilToggleStatus.ps1 @@ -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 diff --git a/functions/private/Invoke-WinUtilCurrentSystem.ps1 b/functions/private/Invoke-WinUtilCurrentSystem.ps1 index 823adca4..fe4778cb 100644 --- a/functions/private/Invoke-WinUtilCurrentSystem.ps1 +++ b/functions/private/Invoke-WinUtilCurrentSystem.ps1 @@ -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 "") { + 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." - } } } }