From 5a45deab1895c7f9268f7f51a0d66b6c4cdf8b61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pl=C3=ADnio=20Larrubia?= Date: Thu, 8 Sep 2022 11:46:36 -0300 Subject: [PATCH] Effectively remove microsoft edge (Except user data) - Folders from Program Files (x86) related to Edge will also be wiped - This is NOT included on apply tweaks, it's isolated on GUI - The reason this was done is because v105 instantly crashed after opened Reminder for those who don't want this to happen: - DON'T open Edge right after boot, wait til' 1 min or other stuff started completely - *The daily upgrade scripts may affect MS Edge from reinstalling --- src/scripts/remove-msedge.ps1 | 37 +++++++++++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/src/scripts/remove-msedge.ps1 b/src/scripts/remove-msedge.ps1 index ec7b7cb..7fe8ba4 100644 --- a/src/scripts/remove-msedge.ps1 +++ b/src/scripts/remove-msedge.ps1 @@ -2,7 +2,7 @@ Import-Module -DisableNameChecking $PSScriptRoot\..\lib\"show-dialog-window.psm1 Import-Module -DisableNameChecking $PSScriptRoot\..\lib\"title-templates.psm1" function Main() { - $Ask = "Are you sure you want to remove Microsoft Edge from Windows?`nYou can reinstall it anytime." + $Ask = "Are you sure you want to remove Microsoft Edge from Windows?`nYou can reinstall it anytime.`nNote: all users logged in will remain." switch (Show-Question -Title "Warning" -Message $Ask -BoxIcon "Warning") { 'Yes' { @@ -18,9 +18,38 @@ function Main() { } function Remove-MSEdge() { - Start-Process -FilePath "$env:SystemDrive\Program Files (x86)\Microsoft\Edge\Application\*\Installer\setup.exe" -ArgumentList "--uninstall", "--system-level", "--verbose-logging", "--force-uninstall" -Wait - Start-Process -FilePath "$env:SystemDrive\Program Files (x86)\Microsoft\EdgeCore\*\Installer\setup.exe" -ArgumentList "--uninstall", "--system-level", "--verbose-logging", "--force-uninstall" -Wait - Remove-Item -Path "$env:LOCALAPPDATA\Packages\Microsoft.MicrosoftEdge*_*" -Confirm -Recurse | Out-Host + $PathToLMEdgeUpdate = "HKLM:\SOFTWARE\Microsoft\EdgeUpdate" + + If ((Test-Path -Path "$env:SystemDrive\Program Files (x86)\Microsoft\Edge\Application") -or (Test-Path -Path "$env:SystemDrive\Program Files (x86)\Microsoft\EdgeWebView\Application")) { + ForEach ($FullName in (Get-ChildItem -Path "$env:SystemDrive\Program Files (x86)\Microsoft\Edge*\Application\*\Installer\setup.exe").FullName) { + Write-Status -Types "@" -Status "Uninstalling MS Edge from $FullName..." + Start-Process -FilePath $FullName -ArgumentList "--uninstall", "--msedgewebview", "--system-level", "--verbose-logging", "--force-uninstall" -Wait + } + } Else { + Write-Status -Types "?" -Status "Edge/EdgeWebView folder does not exist anymore..." -Warning + } + + If (Test-Path -Path "$env:SystemDrive\Program Files (x86)\Microsoft\EdgeCore") { + ForEach ($FullName in (Get-ChildItem -Path "$env:SystemDrive\Program Files (x86)\Microsoft\EdgeCore\*\Installer\setup.exe").FullName) { + Write-Status -Types "@" -Status "Uninstalling MS Edge from $FullName..." + Start-Process -FilePath $FullName -ArgumentList "--uninstall", "--system-level", "--verbose-logging", "--force-uninstall" -Wait + } + } Else { + Write-Status -Types "?" -Status "EdgeCore folder does not exist anymore..." -Warning + } + + Write-Status -Types "@" -Status "Preventing Edge from reinstalling..." + If (!(Test-Path "$PathToLMEdgeUpdate")) { + New-Item -Path "$PathToLMEdgeUpdate" -Force | Out-Null + } + Set-ItemProperty -Path "$PathToLMEdgeUpdate" -Name "DoNotUpdateToEdgeWithChromium" -Type DWord -Value 1 + + Write-Status -Types "@" -Status "Deleting Edge appdata\local folders from current user..." + Remove-Item -Path "$env:LOCALAPPDATA\Packages\Microsoft.MicrosoftEdge*_*" -Recurse -Force | Out-Host + + Write-Status -Types "@" -Status "Deleting Edge from Program Files (x86)..." + Remove-Item -Path "$env:SystemDrive\Program Files (x86)\Microsoft\Edge*" -Recurse -Force | Out-Host + Remove-Item -Path "$env:SystemDrive\Program Files (x86)\Microsoft\Temp" -Recurse -Force | Out-Host } Main \ No newline at end of file