From dd705267318505b002a860c566a57f44707f6a9d Mon Sep 17 00:00:00 2001 From: MyDrift Date: Sat, 11 May 2024 23:01:48 +0200 Subject: [PATCH] Adobe Network Blocking / Adobe Debloater / Tweak Fixes & more (#1954) * Added Applications AFFiNE: Open source Notion alternative with selfhostable option for syncing. Wazuh Agent: Adgent for open-source security monitoring platform * Change layout of toggles Change the layout of the toggles to first show toggles and then the content (text). - testet, works * added snap related toggles - disable snapping entirely (requires relogin of windows user) - disable suggestion to snap other windows next to the snapped window -tested * Layouted Checkboxes, redesigned Toggles & renamed RDCMan - Removed text inside toggle as it can be confusing because it sais "enable" while enabled and "disable" if disabled. The coloring should be enough to know in what state that setting is. - without the text i could make it a little bit smaller while still letting it look good. - Renamed "Remote Desktop Connection Manager (RDCMan)" to "RDCMan" because that name is shorter and also mostly used by the linked site. - layouted checkboxes so they are not more left than the title and look tidy. - tested * Disable Acrobat auto-updates - added script & undoscript to disable automatic downloads & installation of acrobat reader. The user gets a notified if there is an update available. I put some info to that inside the code * edited AFFiNE description * Tweak Adobe Debloater -disable Adobe Desktop Service by getting ownership and renaming it. - added AGMService service - disable AGMService and AGSService entirely * Block Adobe Network, Debloat Adobe & Compile - fixes order of tweaks to always run "WPFTweaksRestorePoint" first. Before it was only the case because if was one of the first letter0s of the alphabet - Fixed some stuff at Debloat Adobe & added Adobe Reader update stopper & "deactivated" Adobe Desktop Service. - Added Blocking of Adobe Servers (as of your suggestion) to it's own Tweak. - ran compile for testing & showing * undo compilation * added Note to AcrobatUpdates Management in Tweak "Debloat Adobe" * Fix Right Click Method to use accurate names * fixed my mistake in README --------- Co-authored-by: Chris Titus --- README.md | 2 +- config/applications.json | 18 +- config/tweaks.json | 245 +++++++++++++++++- functions/private/Get-TabXaml.ps1 | 5 +- functions/private/Get-WinUtilCheckBoxes.ps1 | 22 +- functions/private/Get-WinUtilToggleStatus.ps1 | 18 ++ .../private/Invoke-WinUtilSnapSuggestion.ps1 | 34 +++ .../private/Invoke-WinUtilSnapWindow.ps1 | 31 +++ functions/public/Invoke-WPFToggle.ps1 | 2 + winutil.ps1 | 17 +- xaml/inputApp.xaml | 14 +- xaml/inputXML.xaml | 36 +-- 12 files changed, 386 insertions(+), 58 deletions(-) create mode 100644 functions/private/Invoke-WinUtilSnapSuggestion.ps1 create mode 100644 functions/private/Invoke-WinUtilSnapWindow.ps1 diff --git a/README.md b/README.md index 60c4fec2..a921ad79 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ Winutil must be run in Admin mode because it performs system-wide tweaks. To ach 1. **Right-Click Method:** - Right-click on the start menu. - - Choose "PowerShell As Admin" (for Windows 10) or "Windows Terminal As Admin" (for Windows 11). + - Choose "Windows PowerShell (Admin)" (for Windows 10) or "Terminal (Admin)" (for Windows 11). 2. **Search and Launch Method:** - Press the Windows key. diff --git a/config/applications.json b/config/applications.json index 9f69473b..be6d9a7a 100644 --- a/config/applications.json +++ b/config/applications.json @@ -31,6 +31,14 @@ "link": "https://www.advanced-ip-scanner.com/", "winget": "Famatech.AdvancedIPScanner" }, + "WPFInstallaffine": { + "category": "Document", + "choco": "na", + "content": "AFFiNE", + "description": "AFFiNE is an open source alternative to Notion. Write, draw, plan all at once. Selfhost it to sync across devices.", + "link": "https://affine.pro/", + "winget": "AFFiNE.stable" + }, "WPFInstallaimp": { "category": "Multimedia Tools", "choco": "aimp", @@ -106,7 +114,7 @@ "WPFInstallrdcman": { "category": "Microsoft Tools", "choco": "rdcman", - "content": "Remote Desktop Connection Manager (RDCMan)", + "content": "RDCMan", "description": "RDCMan manages multiple remote desktop connections. It is useful for managing server labs where you need regular access to each machine such as automated checkin systems and data centers.", "link": "https://learn.microsoft.com/en-us/sysinternals/downloads/rdcman", "winget": "Microsoft.Sysinternals.RDCMan" @@ -2367,6 +2375,14 @@ "link": "https://www.waterfox.net/", "winget": "Waterfox.Waterfox" }, + "WPFInstallwazuh": { + "category": "Utilities", + "choco": "wazuh-agent", + "content": "Wazuh.", + "description": "Wazuh is an open-source security monitoring platform that offers intrusion detection, compliance checks, and log analysis.", + "link": "https://wazuh.com/", + "winget": "Wazuh.WazuhAgent" + }, "WPFInstallwezterm": { "category": "Development", "choco": "wezterm", diff --git a/config/tweaks.json b/config/tweaks.json index e260bd3e..2b45b9b5 100644 --- a/config/tweaks.json +++ b/config/tweaks.json @@ -34,7 +34,7 @@ "Description": "Hibernation is really meant for laptops as it saves what's in memory before turning the pc off. It really should never be used, but some people are lazy and rely on it. Don't be like Bob. Bob likes hibernation.", "category": "Essential Tweaks", "panel": "1", - "Order": "a011_", + "Order": "a012_", "registry": [ { "Path": "HKLM:\\System\\CurrentControlSet\\Control\\Session Manager\\Power", @@ -63,7 +63,7 @@ "Description": "Disables HomeGroup - HomeGroup is a password-protected home networking service that lets you share your stuff with other PCs that are currently running and connected to your network.", "category": "Essential Tweaks", "panel": "1", - "Order": "a009_", + "Order": "a011_", "service": [ { "Name": "HomeGroupListener", @@ -77,16 +77,110 @@ } ] }, - "WPFTweaksAdobe": { - "Content": "Disable Adobe Services", - "Description": "Disables many of the services that come with Adobe and run in the background.", + "WPFTweaksDebloatAdobe": { + "Content": "Debloat Adobe", + "Description": "Manages Adobe Services, Adobe Desktop Service, and Acrobat Updates", "category": "Essential Tweaks", "panel": "1", - "Order": "a009_", + "Order": "a009_", + "InvokeScript": [ + " + function CCStopper { + $path = \"C:\\Program Files (x86)\\Common Files\\Adobe\\Adobe Desktop Common\\ADS\\Adobe Desktop Service.exe\" + + # Test if the path exists before proceeding + if (Test-Path $path) { + Takeown /f $path + $acl = Get-Acl $path + $acl.SetOwner([System.Security.Principal.NTAccount]\"Administrators\") + $acl | Set-Acl $path + + Rename-Item -Path $path -NewName \"Adobe Desktop Service.exe.old\" -Force + } else { + Write-Host \"Adobe Desktop Service is not in the default location.\" + } + } + + + function AcrobatUpdates { + # Editing Acrobat Updates. The last folder before the key is dynamic, therefore using a script. + # Possible Values for the edited key: + # 0 = Do not download or install updates automatically + # 2 = Automatically download updates but let the user choose when to install them + # 3 = Automatically download and install updates (default value) + # 4 = Notify the user when an update is available but don't download or install it automatically + # = It notifies the user using Windows Notifications. It runs on startup without having to have a Service/Acrobat/Reader running, therefore 0 is the next best thing. + + $rootPath = \"HKLM:\\SOFTWARE\\WOW6432Node\\Adobe\\Adobe ARM\\Legacy\\Acrobat\" + + # Get all subkeys under the specified root path + $subKeys = Get-ChildItem -Path $rootPath | Where-Object { $_.PSChildName -like \"{*}\" } + + # Loop through each subkey + foreach ($subKey in $subKeys) { + # Get the full registry path + $fullPath = Join-Path -Path $rootPath -ChildPath $subKey.PSChildName + try { + Set-ItemProperty -Path $fullPath -Name Mode -Value 0 + Write-Host \"Acrobat Updates have been disabled.\" + } catch { + Write-Host \"Registry Key for changing Acrobat Updates does not exist in $fullPath\" + } + } + } + + CCStopper + AcrobatUpdates + " + ], + "UndoScript": [ + " + function RestoreCCService { + $originalPath = \"C:\\Program Files (x86)\\Common Files\\Adobe\\Adobe Desktop Common\\ADS\\Adobe Desktop Service.exe.old\" + $newPath = \"C:\\Program Files (x86)\\Common Files\\Adobe\\Adobe Desktop Common\\ADS\\Adobe Desktop Service.exe\" + + if (Test-Path -Path $originalPath) { + Rename-Item -Path $originalPath -NewName \"Adobe Desktop Service.exe\" -Force + Write-Host \"Adobe Desktop Service has been restored.\" + } else { + Write-Host \"Backup file does not exist. No changes were made.\" + } + } + + function AcrobatUpdates { + # Default Value: + # 3 = Automatically download and install updates + + $rootPath = \"HKLM:\\SOFTWARE\\WOW6432Node\\Adobe\\Adobe ARM\\Legacy\\Acrobat\" + + # Get all subkeys under the specified root path + $subKeys = Get-ChildItem -Path $rootPath | Where-Object { $_.PSChildName -like \"{*}\" } + + # Loop through each subkey + foreach ($subKey in $subKeys) { + # Get the full registry path + $fullPath = Join-Path -Path $rootPath -ChildPath $subKey.PSChildName + try { + Set-ItemProperty -Path $fullPath -Name Mode -Value 3 + } catch { + Write-Host \"Registry Key for changing Acrobat Updates does not exist in $fullPath\" + } + } + } + + RestoreCCService + AcrobatUpdates + " + ], "service": [ { "Name": "AGSService", - "StartupType": "Manual", + "StartupType": "Disabled", + "OriginalType": "Automatic" + }, + { + "Name": "AGMService", + "StartupType": "Disabled", "OriginalType": "Automatic" }, { @@ -101,7 +195,7 @@ }, { "Name": "Adobe Genuine Monitor Service", - "StartupType": "Manual", + "StartupType": "Disabled", "OriginalType": "Automatic" }, { @@ -131,6 +225,119 @@ } ] }, + "WPFTweaksBlockAdobeNet": { + "Content": "Block Adobe Networking", + "Description": "Reduce user interruptions by selectively blocking connections to Adobe's activation and telemetry servers. ", + "category": "Essential Tweaks", + "panel": "1", + "Order": "a010_", + "InvokeScript": [ + " + # Define the URL of the remote HOSTS file and the local paths + $remoteHostsUrl = \"https://raw.githubusercontent.com/Ruddernation-Designs/Adobe-URL-Block-List/master/hosts\" + $localHostsPath = \"C:\\Windows\\System32\\drivers\\etc\\hosts\" + $tempHostsPath = \"C:\\Windows\\System32\\drivers\\etc\\temp_hosts\" + + # Download the remote HOSTS file to a temporary location + try { + Invoke-WebRequest -Uri $remoteHostsUrl -OutFile $tempHostsPath + Write-Output \"Downloaded the remote HOSTS file to a temporary location.\" + } + catch { + Write-Error \"Failed to download the HOSTS file. Error: $_\" + } + + # Check if the AdobeNetBlock has already been started + try { + $localHostsContent = Get-Content $localHostsPath -ErrorAction Stop + + # Check if AdobeNetBlock markers exist + $blockStartExists = $localHostsContent -like \"*#AdobeNetBlock-start*\" + if ($blockStartExists) { + Write-Output \"AdobeNetBlock-start already exists. Skipping addition of new block.\" + } else { + # Load the new block from the downloaded file + $newBlockContent = Get-Content $tempHostsPath -ErrorAction Stop + $newBlockContent = $newBlockContent | Where-Object { $_ -notmatch \"^\\s*#\" -and $_ -ne \"\" } # Exclude empty lines and comments + $newBlockHeader = \"#AdobeNetBlock-start\" + $newBlockFooter = \"#AdobeNetBlock-end\" + + # Combine the contents, ensuring new block is properly formatted + $combinedContent = $localHostsContent + $newBlockHeader, $newBlockContent, $newBlockFooter | Out-String + + # Write the combined content back to the original HOSTS file + $combinedContent | Set-Content $localHostsPath -Encoding ASCII + Write-Output \"Successfully added the AdobeNetBlock.\" + } + } + catch { + Write-Error \"Error during processing: $_\" + } + + # Clean up temporary file + Remove-Item $tempHostsPath -ErrorAction Ignore + + # Flush the DNS resolver cache + try { + Invoke-Expression \"ipconfig /flushdns\" + Write-Output \"DNS cache flushed successfully.\" + } + catch { + Write-Error \"Failed to flush DNS cache. Error: $_\" + } + " + ], + "UndoScript": [ + " + # Define the local path of the HOSTS file + $localHostsPath = \"C:\\Windows\\System32\\drivers\\etc\\hosts\" + + # Load the content of the HOSTS file + try { + $hostsContent = Get-Content $localHostsPath -ErrorAction Stop + } + catch { + Write-Error \"Failed to load the HOSTS file. Error: $_\" + return + } + + # Initialize flags and buffer for new content + $recording = $true + $newContent = @() + + # Iterate over each line of the HOSTS file + foreach ($line in $hostsContent) { + if ($line -match \"#AdobeNetBlock-start\") { + $recording = $false + } + if ($recording) { + $newContent += $line + } + if ($line -match \"#AdobeNetBlock-end\") { + $recording = $true + } + } + + # Write the filtered content back to the HOSTS file + try { + $newContent | Set-Content $localHostsPath -Encoding ASCII + Write-Output \"Successfully removed the AdobeNetBlock section from the HOSTS file.\" + } + catch { + Write-Error \"Failed to write back to the HOSTS file. Error: $_\" + } + + # Flush the DNS resolver cache + try { + Invoke-Expression \"ipconfig /flushdns\" + Write-Output \"DNS cache flushed successfully.\" + } + catch { + Write-Error \"Failed to flush DNS cache. Error: $_\" + } + " + ] + }, "WPFTweaksLoc": { "Content": "Disable Location Tracking", "Description": "Disables Location Tracking...DUH!", @@ -2687,12 +2894,28 @@ "Order": "a064_", "Type": "Toggle" }, + "WPFToggleSnapWindow": { + "Content": "Snap Window", + "Description": "If enabled you can align windows by dragging them. | Relogin Required", + "category": "Customize Preferences", + "panel": "2", + "Order": "a065_", + "Type": "Toggle" + }, "WPFToggleSnapFlyout": { "Content": "Snap Assist Flyout", "Description": "If enabled then Snap preview is disabled when maximize button is hovered.", "category": "Customize Preferences", "panel": "2", - "Order": "a065_", + "Order": "a066_", + "Type": "Toggle" + }, + "WPFToggleSnapSuggestion": { + "Content": "Snap Assist Suggestion", + "Description": "If enabled then you will get suggestions to snap other applications in the left over spaces.", + "category": "Customize Preferences", + "panel": "2", + "Order": "a067_", "Type": "Toggle" }, "WPFToggleMouseAcceleration": { @@ -2700,7 +2923,7 @@ "Description": "If Enabled then Cursor movement is affected by the speed of your physical mouse movements.", "category": "Customize Preferences", "panel": "2", - "Order": "a066_", + "Order": "a068_", "Type": "Toggle" }, "WPFToggleStickyKeys": { @@ -2708,7 +2931,7 @@ "Description": "If Enabled then Sticky Keys is activated - Sticky keys is an accessibility feature of some graphical user interfaces which assists users who have physical disabilities or help users reduce repetitive strain injury.", "category": "Customize Preferences", "panel": "2", - "Order": "a067_", + "Order": "a069_", "Type": "Toggle" }, "WPFOOSUbutton": { diff --git a/functions/private/Get-TabXaml.ps1 b/functions/private/Get-TabXaml.ps1 index a420e344..c4bccb9e 100644 --- a/functions/private/Get-TabXaml.ps1 +++ b/functions/private/Get-TabXaml.ps1 @@ -91,8 +91,9 @@ function Get-TabXaml { } $appInfo = $organizedData[$panel][$category][$appName] if ("Toggle" -eq $appInfo.Type) { - $blockXml += "`n`n" + $blockXml += "`n" + $blockXml += "`n" + $blockXml += "`n" } elseif ("Combobox" -eq $appInfo.Type) { $blockXml += "`n + + + - - - @@ -12790,6 +12790,11 @@ $inputXML = ' + + + + + - - - @@ -641,6 +641,11 @@ + + + + +