diff --git a/.github/workflows/compile.yaml b/.github/workflows/compile.yaml index d835423b..5eb73b58 100644 --- a/.github/workflows/compile.yaml +++ b/.github/workflows/compile.yaml @@ -10,6 +10,8 @@ on: jobs: build-runspace: runs-on: windows-latest + env: + CERTIFICATE_BASE64: ${{ secrets.CERTIFICATE_BASE64 }} steps: - uses: actions/checkout@v4 with: @@ -19,7 +21,28 @@ jobs: run: | Set-ExecutionPolicy Bypass -Scope Process -Force; ./Compile.ps1 continue-on-error: false # Directly fail the job on error, removing the need for a separate check + - name: Create and import code signing certificate + shell: pwsh + run: | + [System.IO.File]::WriteAllBytes("$env:USERPROFILE\code-signing-cert.pfx", [System.Convert]::FromBase64String("$env:CERTIFICATE_BASE64")) + Import-PfxCertificate -FilePath "$env:USERPROFILE\code-signing-cert.pfx" -CertStoreLocation Cert:\CurrentUser\My + - name: Code sign winutil.ps1 + shell: pwsh + run: | + $cert = Get-ChildItem -Path Cert:\CurrentUser\My -CodeSigningCert | Select-Object -First 1 + if ($null -eq $cert) { throw "Code signing certificate not found" } + Set-AuthenticodeSignature -FilePath ./winutil.ps1 -Certificate $cert + - name: Verify code signature + shell: pwsh + run: | + $signature = Get-AuthenticodeSignature -FilePath ./winutil.ps1 + if ($signature.Status -ne 'Valid') { throw "Code signing failed" } + - name: Upload winutil.ps1 as artifact + uses: actions/upload-artifact@v2 + with: + name: winutil + path: ./winutil.ps1 - uses: stefanzweifel/git-auto-commit-action@v5 with: commit_message: Compile Winutil - if: success() + if: success() \ No newline at end of file diff --git a/README.md b/README.md index e43bf521..359ea51c 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ If you have Issues, refer to [Known Issues](https://christitustech.github.io/win These are the sponsors that help keep this project alive with monthly contributions. -Gregory NavasarkianYusuke SaitoTriHyderaMark AmosJason A. DiegmuellerwyattJan WilleOwenStefanthaddlPaulDave Jones +Gregory NavasarkianYusuke SaitoTriHyderaMark AmosJason A. DiegmuellerwyattOwenStefanthaddlPaulDave JonesAnthony Mendez ## 🏅 Thanks to all Contributors Thanks a lot for spending your time helping Winutil grow. Thanks a lot! Keep rocking 🍻. diff --git a/config/tweaks.json b/config/tweaks.json index 890a0986..f6a99abf 100644 --- a/config/tweaks.json +++ b/config/tweaks.json @@ -1580,6 +1580,162 @@ } ] }, + "WPFTweaksEdgeDebloat": { + "Content": "Debloat Edge", + "Description": "Disables various telemetry options, popups, and other annoyances in Edge.", + "category": "Essential Tweaks", + "panel": "1", + "Order": "a016_", + "registry": [ + { + "Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\EdgeUpdate", + "Name": "CreateDesktopShortcutDefault", + "Type": "DWord", + "Value": "0", + "OriginalValue": "1" + }, + { + "Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Edge", + "Name": "EdgeEnhanceImagesEnabled", + "Type": "DWord", + "Value": "0", + "OriginalValue": "1" + }, + { + "Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Edge", + "Name": "PersonalizationReportingEnabled", + "Type": "DWord", + "Value": "0", + "OriginalValue": "1" + }, + { + "Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Edge", + "Name": "ShowRecommendationsEnabled", + "Type": "DWord", + "Value": "0", + "OriginalValue": "1" + }, + { + "Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Edge", + "Name": "HideFirstRunExperience", + "Type": "DWord", + "Value": "1", + "OriginalValue": "0" + }, + { + "Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Edge", + "Name": "UserFeedbackAllowed", + "Type": "DWord", + "Value": "0", + "OriginalValue": "1" + }, + { + "Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Edge", + "Name": "ConfigureDoNotTrack", + "Type": "DWord", + "Value": "1", + "OriginalValue": "0" + }, + { + "Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Edge", + "Name": "AlternateErrorPagesEnabled", + "Type": "DWord", + "Value": "0", + "OriginalValue": "1" + }, + { + "Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Edge", + "Name": "EdgeCollectionsEnabled", + "Type": "DWord", + "Value": "0", + "OriginalValue": "1" + }, + { + "Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Edge", + "Name": "EdgeFollowEnabled", + "Type": "DWord", + "Value": "0", + "OriginalValue": "1" + }, + { + "Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Edge", + "Name": "EdgeShoppingAssistantEnabled", + "Type": "DWord", + "Value": "0", + "OriginalValue": "1" + }, + { + "Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Edge", + "Name": "MicrosoftEdgeInsiderPromotionEnabled", + "Type": "DWord", + "Value": "0", + "OriginalValue": "1" + }, + { + "Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Edge", + "Name": "PersonalizationReportingEnabled", + "Type": "DWord", + "Value": "0", + "OriginalValue": "1" + }, + { + "Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Edge", + "Name": "ShowMicrosoftRewards", + "Type": "DWord", + "Value": "0", + "OriginalValue": "1" + }, + { + "Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Edge", + "Name": "WebWidgetAllowed", + "Type": "DWord", + "Value": "0", + "OriginalValue": "1" + }, + { + "Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Edge", + "Name": "DiagnosticData", + "Type": "DWord", + "Value": "0", + "OriginalValue": "1" + }, + { + "Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Edge", + "Name": "EdgeAssetDeliveryServiceEnabled", + "Type": "DWord", + "Value": "0", + "OriginalValue": "1" + }, + { + "Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Edge", + "Name": "EdgeCollectionsEnabled", + "Type": "DWord", + "Value": "0", + "OriginalValue": "1" + }, + { + "Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Edge", + "Name": "CryptoWalletEnabled", + "Type": "DWord", + "Value": "0", + "OriginalValue": "1" + }, + { + "Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Edge", + "Name": "ConfigureDoNotTrack", + "Type": "DWord", + "Value": "1", + "OriginalValue": "0" + }, + { + "Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Edge", + "Name": "WalletDonationEnabled", + "Type": "DWord", + "Value": "0", + "OriginalValue": "1" + } + ] + }, "WPFTweaksConsumerFeatures":{ "Content": "Disable ConsumerFeatures", "Description": "Windows 10 will not automatically install any games, third-party apps, or application links from the Windows Store for the signed-in user. Some default Apps will be inaccessible (eg. Phone Link)", diff --git a/docs/contribute.md b/docs/contribute.md index d7caa9ed..b5a76cc4 100644 --- a/docs/contribute.md +++ b/docs/contribute.md @@ -46,18 +46,20 @@ ### Overview ``` mermaid -graph LR +%%{init: {"flowchart": {"curve": "cardinal"}} }%% +graph TD   A[Fork Project] --> B[Clone Repository];   B --> C[Create New Branch];   C --> D[Make Changes];   D --> G[Test Changes];   G --> H{Tests Passed?};   H -->|Yes| E[Commit Changes]; -  E --> F[Push Branch];   H -->|No| J[Fix Issues]; +  J --> G; +  E --> F[Push Branch];   F --> K[Create Pull Request];   K --> L[Fill out PR template]; -  J --> G; + classDef default stroke:#333,stroke-width:4px,font-size:12pt; ``` !!! info @@ -65,8 +67,10 @@ graph LR ### Fork the Repo * Fork the WinUtil Repository [here](https://github.com/ChrisTitusTech/winutil) to create a copy that will be available in your repository list. + ![Fork Image](assets/Fork-Button-Dark.png#only-dark) -![FOrk Image](assets/Fork-Button-Light.png#only-light) + +![Fork Image](assets/Fork-Button-Light.png#only-light) ### Clone the Fork !!! tip @@ -89,15 +93,22 @@ graph LR * `cd {path to the folder with the compile.ps1}` * Run the following command to compile and run WinUtil: * `.\Compile.ps1 -run` -* ![Compile](assets/Compile.png) + +![Compile](assets/Compile.png) + * After seeing that your changes work properly, feel free to commit the changes to the repository and make a PR. For help on that, follow the documentation below. ### Committing the changes * Before committing your changes, please discard changes made to the `winutil.ps1` file, like the following: -- ![Push Commit Image](assets/Discard-GHD.png) + +![Push Commit Image](assets/Discard-GHD.png) + * Now, commit your changes once you are happy with the result. + ![Commit Image](assets/Commit-GHD.png) + * Push the changes to upload them to your fork on github.com. + ![Push Commit Image](assets/Push-Commit.png) ### Making a PR diff --git a/docs/index.md b/docs/index.md index c3c94e06..02ddf349 100644 --- a/docs/index.md +++ b/docs/index.md @@ -2,7 +2,6 @@ [![Version](https://img.shields.io/github/v/release/ChrisTitusTech/winutil?color=%230567ff&label=Latest%20Release&style=for-the-badge)](https://github.com/ChrisTitusTech/winutil/releases/latest) ![GitHub Downloads (specific asset, all releases)](https://img.shields.io/github/downloads/ChrisTitusTech/winutil/winutil.ps1?label=Total%20Downloads&style=for-the-badge) - [![Discord Community Server](https://dcbadge.limes.pink/api/server/https://discord.gg/RUbZUZyByQ)](https://discord.gg/RUbZUZyByQ) Welcome to the official documentation for WinUtil, your go-to utility for optimizing and managing your Windows environment. Whether you’re an IT professional, power user, or regular user, WinUtil provides a comprehensive set of tools to enhance your Windows experience. diff --git a/edgeremoval.ps1 b/edgeremoval.ps1 deleted file mode 100644 index 516ac225..00000000 --- a/edgeremoval.ps1 +++ /dev/null @@ -1,253 +0,0 @@ -# Script Metadata -# Created by AveYo, source: https://raw.githubusercontent.com/AveYo/fox/main/Edge_Removal.bat -# Powershell Conversion and Refactor done by Chris Titus Tech - -# Initial Configuration -$host.ui.RawUI.WindowTitle = 'Edge Removal - Chris Titus Tech 2023.05.10' -$remove_win32 = @("Microsoft Edge", "Microsoft Edge Update") -$remove_appx = @("MicrosoftEdge") -$skip = @() # Optional: @("DevTools") - -$also_remove_webview = 0 -if ($also_remove_webview -eq 1) { - $remove_win32 += "Microsoft EdgeWebView" - $remove_appx += "WebExperience", "Win32WebViewHost" -} - -# Administrative Privileges Check -$privileges = @( - 'SeSecurityPrivilege', - 'SeTakeOwnershipPrivilege', - 'SeBackupPrivilege', - 'SeRestorePrivilege' -) - -foreach ($privilege in $privileges) { - [System.Diagnostics.Process]::SetPrivilege($privilege, 2) -} - -# Edge Removal Procedures -$processesToShutdown = @( - 'explorer', 'Widgets', 'widgetservice', 'msedgewebview2', 'MicrosoftEdge*', 'chredge', - 'msedge', 'edge', 'msteams', 'msfamily', 'WebViewHost', 'Clipchamp' -) - -Stop-Process -Name "explorer" -Force -ErrorAction SilentlyContinue -$processesToShutdown | ForEach-Object { - Stop-Process -Name $_ -Force -ErrorAction SilentlyContinue -} - -$MS = ($env:ProgramFiles, ${env:ProgramFiles(x86)})[[Environment]::Is64BitOperatingSystem] + '\Microsoft\Edge\Application\msedge.exe' - -Remove-Item -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\msedge.exe" -Recurse -ErrorAction SilentlyContinue -Remove-Item -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\ie_to_edge_stub.exe" -Recurse -ErrorAction SilentlyContinue -Remove-Item -Path 'Registry::HKEY_Users\S-1-5-21*\Software\Classes\microsoft-edge' -Recurse -ErrorAction SilentlyContinue -Remove-Item -Path 'Registry::HKEY_Users\S-1-5-21*\Software\Classes\MSEdgeHTM' -Recurse -ErrorAction SilentlyContinue - -New-Item -Path "HKLM:\SOFTWARE\Classes\microsoft-edge\shell\open\command" -Force -ErrorAction SilentlyContinue -Set-ItemProperty -Path "HKLM:\SOFTWARE\Classes\microsoft-edge\shell\open\command" -Name '(Default)' -Value "`"$MS`" --single-argument %%1" -Force -ErrorAction SilentlyContinue - -New-Item -Path "HKLM:\SOFTWARE\Classes\MSEdgeHTM\shell\open\command" -Force -ErrorAction SilentlyContinue -Set-ItemProperty -Path "HKLM:\SOFTWARE\Classes\MSEdgeHTM\shell\open\command" -Name '(Default)' -Value "`"$MS`" --single-argument %%1" -Force -ErrorAction SilentlyContinue - -$registryPaths = @('HKLM:\SOFTWARE\Policies', 'HKLM:\SOFTWARE', 'HKLM:\SOFTWARE\WOW6432Node') -$edgeProperties = @('InstallDefault', 'Install{56EB18F8-B008-4CBD-B6D2-8C97FE7E9062}', 'Install{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}') -foreach ($path in $registryPaths) { - foreach ($prop in $edgeProperties) { - Remove-ItemProperty -Path "$path\Microsoft\EdgeUpdate" -Name $prop -Force -ErrorAction SilentlyContinue - } -} - -$edgeupdate = 'Microsoft\EdgeUpdate\Clients\{56EB18F8-B008-4CBD-B6D2-8C97FE7E9062}' -$webvupdate = 'Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}' -$on_actions = @('on-os-upgrade', 'on-logon', 'on-logon-autolaunch', 'on-logon-startup-boost') -$registryBases = @('HKLM:\SOFTWARE', 'HKLM:\SOFTWARE\Wow6432Node') -foreach ($base in $registryBases) { - foreach ($launch in $on_actions) { - Remove-Item -Path "$base\$edgeupdate\Commands\$launch" -Force -ErrorAction SilentlyContinue - Remove-Item -Path "$base\$webvupdate\Commands\$launch" -Force -ErrorAction SilentlyContinue - } -} - -$registryPaths = @('HKCU:', 'HKLM:') -$nodes = @('', '\Wow6432Node') -foreach ($regPath in $registryPaths) { - foreach ($node in $nodes) { - foreach ($i in $remove_win32) { - Remove-ItemProperty -Path "$regPath\SOFTWARE${node}\Microsoft\Windows\CurrentVersion\Uninstall\$i" -Name 'NoRemove' -Force -ErrorAction SilentlyContinue - New-Item -Path "$regPath\SOFTWARE${node}\Microsoft\EdgeUpdateDev" -Force | Out-Null - Set-ItemProperty -Path "$regPath\SOFTWARE${node}\Microsoft\EdgeUpdateDev" -Name 'AllowUninstall' -Value 1 -Type Dword -Force - } - } -} - -$foldersToSearch = @('LocalApplicationData', 'ProgramFilesX86', 'ProgramFiles') | ForEach-Object { - [Environment]::GetFolderPath($_) -} - -$edges = @() -$bhoFiles = @() - -foreach ($folder in $foldersToSearch) { - $bhoFiles += Get-ChildItem -Path "$folder\Microsoft\Edge*\ie_to_edge_stub.exe" -Recurse -ErrorAction SilentlyContinue - - $edges += Get-ChildItem -Path "$folder\Microsoft\Edge*\setup.exe" -Recurse -ErrorAction SilentlyContinue | - Where-Object { $_.FullName -notlike '*EdgeWebView*' } -} - -$destinationDir = "$env:SystemDrive\Scripts" -New-Item -Path $destinationDir -ItemType Directory -ErrorAction SilentlyContinue | Out-Null - -foreach ($bhoFile in $bhoFiles) { - if (Test-Path $bhoFile) { - try { - Copy-Item -Path $bhoFile -Destination "$destinationDir\ie_to_edge_stub.exe" -Force - } catch { } - } -} - -## Work on Appx Removals -$provisioned = Get-AppxProvisionedPackage -Online -$appxpackage = Get-AppxPackage -AllUsers -$eol = @() - -$store = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Store' -$storeP = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Store\InstalledApplications' -foreach ($app in $appxpackage) { - $name = $app.Name - if ($app.Name -eq "Microsoft.Edge") { - $eol += $name - } elseif ($app.Name -eq "Microsoft.EdgeBeta" -or $app.Name -eq "Microsoft.EdgeDev" -or $app.Name -eq "Microsoft.EdgeCanary" -or $app.Name -eq "Microsoft.MicrosoftEdge") { - $eol += $name - } -} - -$eolApps = $provisioned | Where-Object { $eol -contains $_.DisplayName } - -foreach ($edge in $eolApps) { - $edgeName = $edge.DisplayName - if (-not ($skip -contains $edgeName)) { - try { - Remove-AppxProvisionedPackage -Online -PackageName $edgeName -ErrorAction SilentlyContinue - } catch { } - } -} - -foreach ($edge in $appxpackage) { - $edgeName = $edge.Name - if ($eol -contains $edgeName) { - if (-not ($skip -contains $edgeName)) { - try { - Remove-AppxPackage -Package $edgeName -AllUsers -ErrorAction SilentlyContinue - } catch { } - } - } -} - -## Redirect shortcuts -$shortcut_path = "$env:Public\Desktop" -$shortcut_file = 'Microsoft Edge.lnk' -$full_path = Join-Path -Path $shortcut_path -ChildPath $shortcut_file - -if (Test-Path $full_path) { - Remove-Item -Path $full_path -Force -ErrorAction SilentlyContinue -} - -$shortcut_path = "$env:ProgramData\Microsoft\Windows\Start Menu\Programs" -$shortcut_file = 'Microsoft Edge.lnk' -$full_path = Join-Path -Path $shortcut_path -ChildPath $shortcut_file - -if (Test-Path $full_path) { - Remove-Item -Path $full_path -Force -ErrorAction SilentlyContinue -} - -$edgePolicy = 'HKLM:\SOFTWARE\Policies\Microsoft\Edge' -if (-not (Test-Path $edgePolicy)) { - New-Item -Path $edgePolicy -Force | Out-Null -} - -$edgePrefs = @{ - 'Dword' = @{ - 'BrowserReplacementEnabled' = 1 - 'HideFirstRunExperience' = 1 - 'HideImportEdgeFavoritesPrompt' = 1 - 'HideSyncSetupExperience' = 1 - 'FavoritesBarVisibility' = 1 - } - 'String' = @{ - 'AutoplayAllowed' = 'AllowOnce' - } -} - -foreach ($entryType in $edgePrefs.Keys) { - foreach ($prefName in $edgePrefs[$entryType].Keys) { - Set-ItemProperty -Path $edgePolicy -Name $prefName -Value $edgePrefs[$entryType][$prefName] -Type $entryType -Force - } -} - -# Output Results -Write-Host "Edge Removal Complete" -ForegroundColor Green - -# Define constants and initial configuration -$ScriptVersion = "2023.05.10" -$EdgeProcessesToShutdown = @('explorer', 'Widgets', 'widgetservice', 'msedgewebview2', 'MicrosoftEdge*', 'chredge', 'msedge', 'edge', 'msteams', 'msfamily', 'WebViewHost', 'Clipchamp') -$EdgeRemovalOptions = @{ - RemoveWin32 = @("Microsoft Edge", "Microsoft Edge Update") - RemoveAppx = @("MicrosoftEdge") - Skip = @() # Optional: @("DevTools") - AlsoRemoveWebView = $false -} - -# Define main function to remove Microsoft Edge components -function Remove-MicrosoftEdge { - [CmdletBinding()] - param() - - # Function to shutdown processes related to Microsoft Edge - function Stop-EdgeProcesses { - $EdgeProcessesToShutdown | ForEach-Object { - Stop-Process -Name $_ -Force -ErrorAction SilentlyContinue - } - } - - # Function to remove registry entries related to Microsoft Edge - function Remove-EdgeRegistryEntries { - # Clean up certain registry entries - Remove-Item -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\msedge.exe" -Recurse -ErrorAction SilentlyContinue - Remove-Item -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\ie_to_edge_stub.exe" -Recurse -ErrorAction SilentlyContinue - Remove-Item -Path 'Registry::HKEY_Users\S-1-5-21*\Software\Classes\microsoft-edge' -Recurse -ErrorAction SilentlyContinue - Remove-Item -Path 'Registry::HKEY_Users\S-1-5-21*\Software\Classes\MSEdgeHTM' -Recurse -ErrorAction SilentlyContinue - - # Create new registry entries - $EdgeExecutablePath = ($env:ProgramFiles, ${env:ProgramFiles(x86)})[[Environment]::Is64BitOperatingSystem] + '\Microsoft\Edge\Application\msedge.exe' - New-Item -Path "HKLM:\SOFTWARE\Classes\microsoft-edge\shell\open\command" -Force -ErrorAction SilentlyContinue - Set-ItemProperty -Path "HKLM:\SOFTWARE\Classes\microsoft-edge\shell\open\command" -Name '(Default)' -Value "`"$EdgeExecutablePath`" --single-argument %%1" -Force -ErrorAction SilentlyContinue - - New-Item -Path "HKLM:\SOFTWARE\Classes\MSEdgeHTM\shell\open\command" -Force -ErrorAction SilentlyContinue - Set-ItemProperty -Path "HKLM:\SOFTWARE\Classes\MSEdgeHTM\shell\open\command" -Name '(Default)' -Value "`"$EdgeExecutablePath`" --single-argument %%1" -Force -ErrorAction SilentlyContinue - } - - # Function to remove Microsoft Edge AppX packages - function Remove-EdgeAppxPackages { - $EdgeRemovalOptions.RemoveAppx | ForEach-Object { - # Remove provisioned packages - Get-AppxProvisionedPackage -Online | Where-Object { $_.PackageName -like "*$_*" -and $EdgeRemovalOptions.Skip -notcontains $_.PackageName } | Remove-AppxProvisionedPackage -Online -AllUsers -ErrorAction SilentlyContinue - - # Remove installed packages - Get-AppxPackage -AllUsers | Where-Object { $_.PackageFullName -like "*$_*" -and $EdgeRemovalOptions.Skip -notcontains $_.PackageFullName } | Remove-AppxPackage -AllUsers -ErrorAction SilentlyContinue - } - } - - # Function to remove Microsoft Edge processes, registry entries, and AppX packages - try { - Stop-EdgeProcesses - Remove-EdgeRegistryEntries - Remove-EdgeAppxPackages - Write-Output "Microsoft Edge components have been successfully removed." - } catch { - Write-Error "Failed to remove Microsoft Edge components: $_" - } -} - -# Execute the main function -Remove-MicrosoftEdge diff --git a/functions/private/Show-CustomDialog.ps1 b/functions/private/Show-CustomDialog.ps1 index 236a3d62..ab3b1519 100644 --- a/functions/private/Show-CustomDialog.ps1 +++ b/functions/private/Show-CustomDialog.ps1 @@ -44,13 +44,14 @@ function Show-CustomDialog { Add-Type -AssemblyName PresentationFramework # Define theme colors - $foregroundColor = [Windows.Media.Brushes]::White - $backgroundColor = [Windows.Media.Brushes]::Black + $foregroundColor = $sync.configs.themes.$ctttheme.MainForegroundColor + $backgroundColor = $sync.configs.themes.$ctttheme.MainBackgroundColor $font = New-Object Windows.Media.FontFamily("Consolas") - $borderColor = [Windows.Media.Brushes]::Green - $buttonBackgroundColor = [Windows.Media.Brushes]::Black - $buttonForegroundColor = [Windows.Media.Brushes]::White + $borderColor = $sync.configs.themes.$ctttheme.BorderColor # ButtonInstallBackgroundColor + $buttonBackgroundColor = $sync.configs.themes.$ctttheme.ButtonInstallBackgroundColor + $buttonForegroundColor = $sync.configs.themes.$ctttheme.ButtonInstallForegroundColor $shadowColor = [Windows.Media.ColorConverter]::ConvertFromString("#AAAAAAAA") + $logocolor = $sync.configs.themes.$ctttheme.ButtonBackgroundPressedColor # Create a custom dialog window $dialog = New-Object Windows.Window @@ -180,7 +181,7 @@ $cttLogoPath = @" # Add SVG path $svgPath = New-Object Windows.Shapes.Path $svgPath.Data = [Windows.Media.Geometry]::Parse($cttLogoPath) - $svgPath.Fill = $foregroundColor # Set fill color to white + $svgPath.Fill = $logocolor # Set fill color to white # Add SVG path to Viewbox $viewbox.Child = $svgPath @@ -192,7 +193,7 @@ $cttLogoPath = @" $winutilTextBlock = New-Object Windows.Controls.TextBlock $winutilTextBlock.Text = "Winutil" $winutilTextBlock.FontSize = $HeaderFontSize - $winutilTextBlock.Foreground = $foregroundColor + $winutilTextBlock.Foreground = $logocolor $winutilTextBlock.Margin = New-Object Windows.Thickness(10, 5, 10, 5) # Add margins around the text block $stackPanel.Children.Add($winutilTextBlock) # Add TextBlock for information with text wrapping and margins @@ -219,18 +220,19 @@ $cttLogoPath = @" $hyperlink.NavigateUri = New-Object System.Uri($match.Groups[1].Value) $hyperlink.Inlines.Add($match.Groups[2].Value) $hyperlink.TextDecorations = [Windows.TextDecorations]::None # Remove underline - $hyperlink.Foreground = $foregroundColor + $hyperlink.Foreground = $sync.configs.themes.$ctttheme.LinkForegroundColor + $hyperlink.Add_Click({ param($sender, $args) Start-Process $sender.NavigateUri.AbsoluteUri }) $hyperlink.Add_MouseEnter({ param($sender, $args) - $sender.Foreground = [Windows.Media.Brushes]::LightGray + $sender.Foreground = $sync.configs.themes.$ctttheme.LinkHoverForegroundColor }) $hyperlink.Add_MouseLeave({ param($sender, $args) - $sender.Foreground = $foregroundColor + $sender.Foreground = $sync.configs.themes.$ctttheme.LinkForegroundColor }) $messageTextBlock.Inlines.Add($hyperlink) diff --git a/functions/public/Invoke-WPFShortcut.ps1 b/functions/public/Invoke-WPFShortcut.ps1 index e759eb20..6b25bdfe 100644 --- a/functions/public/Invoke-WPFShortcut.ps1 +++ b/functions/public/Invoke-WPFShortcut.ps1 @@ -1,4 +1,3 @@ - function Invoke-WPFShortcut { <# @@ -31,7 +30,6 @@ function Invoke-WPFShortcut { $shellArgs = "-ExecutionPolicy Bypass -Command `"Start-Process $shell -verb runas -ArgumentList `'-Command `"irm https://github.com/ChrisTitusTech/winutil/releases/latest/download/winutil.ps1 | iex`"`'" $DestinationName = "WinUtil.lnk" - } } @@ -51,8 +49,8 @@ function Invoke-WPFShortcut { # Prepare the Shortcut paramter $WshShell = New-Object -comObject WScript.Shell $Shortcut = $WshShell.CreateShortcut($FileBrowser.FileName) - $Shortcut.TargetPath = $SourceExe - $Shortcut.Arguments = $ArgumentsToSourceExe + $Shortcut.TargetPath = $shell + $Shortcut.Arguments = $shellArgs if (Test-Path -Path $winutildir["logo.ico"]) { $shortcut.IconLocation = $winutildir["logo.ico"] } diff --git a/winutil.ps1 b/winutil.ps1 index e6e5c218..6e2301fe 100644 --- a/winutil.ps1 +++ b/winutil.ps1 @@ -8,7 +8,7 @@ Author : Chris Titus @christitustech Runspace Author: @DeveloperDurp GitHub : https://github.com/ChrisTitusTech - Version : 24.07.31 + Version : 24.08.06 #> param ( [switch]$Debug, @@ -45,7 +45,7 @@ Add-Type -AssemblyName System.Windows.Forms # Variable to sync between runspaces $sync = [Hashtable]::Synchronized(@{}) $sync.PSScriptRoot = $PSScriptRoot -$sync.version = "24.07.31" +$sync.version = "24.08.06" $sync.configs = @{} $sync.ProcessRunning = $false @@ -3241,13 +3241,14 @@ function Show-CustomDialog { Add-Type -AssemblyName PresentationFramework # Define theme colors - $foregroundColor = [Windows.Media.Brushes]::White - $backgroundColor = [Windows.Media.Brushes]::Black + $foregroundColor = $sync.configs.themes.$ctttheme.MainForegroundColor + $backgroundColor = $sync.configs.themes.$ctttheme.MainBackgroundColor $font = New-Object Windows.Media.FontFamily("Consolas") - $borderColor = [Windows.Media.Brushes]::Green - $buttonBackgroundColor = [Windows.Media.Brushes]::Black - $buttonForegroundColor = [Windows.Media.Brushes]::White + $borderColor = $sync.configs.themes.$ctttheme.BorderColor # ButtonInstallBackgroundColor + $buttonBackgroundColor = $sync.configs.themes.$ctttheme.ButtonInstallBackgroundColor + $buttonForegroundColor = $sync.configs.themes.$ctttheme.ButtonInstallForegroundColor $shadowColor = [Windows.Media.ColorConverter]::ConvertFromString("#AAAAAAAA") + $logocolor = $sync.configs.themes.$ctttheme.ButtonBackgroundPressedColor # Create a custom dialog window $dialog = New-Object Windows.Window @@ -3377,7 +3378,7 @@ $cttLogoPath = @" # Add SVG path $svgPath = New-Object Windows.Shapes.Path $svgPath.Data = [Windows.Media.Geometry]::Parse($cttLogoPath) - $svgPath.Fill = $foregroundColor # Set fill color to white + $svgPath.Fill = $logocolor # Set fill color to white # Add SVG path to Viewbox $viewbox.Child = $svgPath @@ -3389,7 +3390,7 @@ $cttLogoPath = @" $winutilTextBlock = New-Object Windows.Controls.TextBlock $winutilTextBlock.Text = "Winutil" $winutilTextBlock.FontSize = $HeaderFontSize - $winutilTextBlock.Foreground = $foregroundColor + $winutilTextBlock.Foreground = $logocolor $winutilTextBlock.Margin = New-Object Windows.Thickness(10, 5, 10, 5) # Add margins around the text block $stackPanel.Children.Add($winutilTextBlock) # Add TextBlock for information with text wrapping and margins @@ -3416,18 +3417,19 @@ $cttLogoPath = @" $hyperlink.NavigateUri = New-Object System.Uri($match.Groups[1].Value) $hyperlink.Inlines.Add($match.Groups[2].Value) $hyperlink.TextDecorations = [Windows.TextDecorations]::None # Remove underline - $hyperlink.Foreground = $foregroundColor + $hyperlink.Foreground = $sync.configs.themes.$ctttheme.LinkForegroundColor + $hyperlink.Add_Click({ param($sender, $args) Start-Process $sender.NavigateUri.AbsoluteUri }) $hyperlink.Add_MouseEnter({ param($sender, $args) - $sender.Foreground = [Windows.Media.Brushes]::LightGray + $sender.Foreground = $sync.configs.themes.$ctttheme.LinkHoverForegroundColor }) $hyperlink.Add_MouseLeave({ param($sender, $args) - $sender.Foreground = $foregroundColor + $sender.Foreground = $sync.configs.themes.$ctttheme.LinkForegroundColor }) $messageTextBlock.Inlines.Add($hyperlink) @@ -5308,7 +5310,6 @@ function Invoke-WPFRunspace { [System.GC]::Collect() } } - function Invoke-WPFShortcut { <# @@ -5342,7 +5343,6 @@ function Invoke-WPFShortcut { $shellArgs = "-ExecutionPolicy Bypass -Command `"Start-Process $shell -verb runas -ArgumentList `'-Command `"irm https://github.com/ChrisTitusTech/winutil/releases/latest/download/winutil.ps1 | iex`"`'" $DestinationName = "WinUtil.lnk" - } } @@ -5362,8 +5362,8 @@ function Invoke-WPFShortcut { # Prepare the Shortcut paramter $WshShell = New-Object -comObject WScript.Shell $Shortcut = $WshShell.CreateShortcut($FileBrowser.FileName) - $Shortcut.TargetPath = $SourceExe - $Shortcut.Arguments = $ArgumentsToSourceExe + $Shortcut.TargetPath = $shell + $Shortcut.Arguments = $shellArgs if (Test-Path -Path $winutildir["logo.ico"]) { $shortcut.IconLocation = $winutildir["logo.ico"] } @@ -10950,6 +10950,162 @@ $sync.configs.tweaks = '{ } ] }, + "WPFTweaksEdgeDebloat": { + "Content": "Debloat Edge", + "Description": "Disables various telemetry options, popups, and other annoyances in Edge.", + "category": "Essential Tweaks", + "panel": "1", + "Order": "a016_", + "registry": [ + { + "Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\EdgeUpdate", + "Name": "CreateDesktopShortcutDefault", + "Type": "DWord", + "Value": "0", + "OriginalValue": "1" + }, + { + "Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Edge", + "Name": "EdgeEnhanceImagesEnabled", + "Type": "DWord", + "Value": "0", + "OriginalValue": "1" + }, + { + "Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Edge", + "Name": "PersonalizationReportingEnabled", + "Type": "DWord", + "Value": "0", + "OriginalValue": "1" + }, + { + "Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Edge", + "Name": "ShowRecommendationsEnabled", + "Type": "DWord", + "Value": "0", + "OriginalValue": "1" + }, + { + "Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Edge", + "Name": "HideFirstRunExperience", + "Type": "DWord", + "Value": "1", + "OriginalValue": "0" + }, + { + "Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Edge", + "Name": "UserFeedbackAllowed", + "Type": "DWord", + "Value": "0", + "OriginalValue": "1" + }, + { + "Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Edge", + "Name": "ConfigureDoNotTrack", + "Type": "DWord", + "Value": "1", + "OriginalValue": "0" + }, + { + "Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Edge", + "Name": "AlternateErrorPagesEnabled", + "Type": "DWord", + "Value": "0", + "OriginalValue": "1" + }, + { + "Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Edge", + "Name": "EdgeCollectionsEnabled", + "Type": "DWord", + "Value": "0", + "OriginalValue": "1" + }, + { + "Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Edge", + "Name": "EdgeFollowEnabled", + "Type": "DWord", + "Value": "0", + "OriginalValue": "1" + }, + { + "Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Edge", + "Name": "EdgeShoppingAssistantEnabled", + "Type": "DWord", + "Value": "0", + "OriginalValue": "1" + }, + { + "Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Edge", + "Name": "MicrosoftEdgeInsiderPromotionEnabled", + "Type": "DWord", + "Value": "0", + "OriginalValue": "1" + }, + { + "Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Edge", + "Name": "PersonalizationReportingEnabled", + "Type": "DWord", + "Value": "0", + "OriginalValue": "1" + }, + { + "Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Edge", + "Name": "ShowMicrosoftRewards", + "Type": "DWord", + "Value": "0", + "OriginalValue": "1" + }, + { + "Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Edge", + "Name": "WebWidgetAllowed", + "Type": "DWord", + "Value": "0", + "OriginalValue": "1" + }, + { + "Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Edge", + "Name": "DiagnosticData", + "Type": "DWord", + "Value": "0", + "OriginalValue": "1" + }, + { + "Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Edge", + "Name": "EdgeAssetDeliveryServiceEnabled", + "Type": "DWord", + "Value": "0", + "OriginalValue": "1" + }, + { + "Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Edge", + "Name": "EdgeCollectionsEnabled", + "Type": "DWord", + "Value": "0", + "OriginalValue": "1" + }, + { + "Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Edge", + "Name": "CryptoWalletEnabled", + "Type": "DWord", + "Value": "0", + "OriginalValue": "1" + }, + { + "Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Edge", + "Name": "ConfigureDoNotTrack", + "Type": "DWord", + "Value": "1", + "OriginalValue": "0" + }, + { + "Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Edge", + "Name": "WalletDonationEnabled", + "Type": "DWord", + "Value": "0", + "OriginalValue": "1" + } + ] + }, "WPFTweaksConsumerFeatures": { "Content": "Disable ConsumerFeatures", "Description": "Windows 10 will not automatically install any games, third-party apps, or application links from the Windows Store for the signed-in user. Some default Apps will be inaccessible (eg. Phone Link)", @@ -14939,6 +15095,7 @@ $inputXML = ' +