ShadowWhisperer / Remove-MS-Edge

Uninstall Microsoft Edge silently, through an executable or batch script.
2.21k stars 81 forks source link

Script not working any more! #9

Closed Jamskijam closed 1 year ago

Jamskijam commented 1 year ago

Hi! In new version of Edge this command not working any more. setup.exe --uninstall --system-level --force-uninstall Also, the program is not uninstalled through "Programs and Features" and "Applications and features"

ShadowWhisperer commented 1 year ago

I have seen some systems that have a corrupted setup.exe file. Using Revo Uninstaller will remove it.

I use it at least 3 times a day on fully updated systems. Windows 8-11, and haven't had any issues. (Mix of new and customer machines). Just tried it now, and was successful.

Also, the program is not uninstalled through "Programs and Features" and "Applications and features"

I have never seen it work from there, except on Windows 7.... maybe 8?

When you run my .bat script. does it show Removing Microsoft Edge a bunch of times, in a row, on the screen? What version Windows are you running? (8,10,11,S mode)

I'll do some further investigating.

Jamskijam commented 1 year ago

What version Windows are you running? (8,10,11,S mode)

Windows 10 x86-x64 (21H1), I see this problem in the 21H1 version

WayneSherman commented 1 year ago

I suspect Microsoft pushed out an Edge update between 2022-May and 2022-Oct which caused the removal script to stop working. Another script also stopped working that used to work for Win 10 Pro 21H2. See here: https://github.com/AveYo/fox/issues/26

ShadowWhisperer commented 1 year ago

Strange. I wonder if it's just certain systems, or if there is something else installed.
I've been messing with Edge on Windows 10/11 in a virtual machine, and can't get it to fail.
It's been working fine on almost every system I've ran this on, that's been fully updated. Mostly Windows 10, factory built.
(I should mention I own a small town computer shop. If customers use Edge, I leave it. If they don't, I remove it)

WayneSherman commented 1 year ago

To make testing faster, I also use VMs. The install of Windows is a vanilla factory install with the following changes:

I just tested your "Remove-Edge.bat" on Win 10 Pro 21H2 with latest updates to 2022-May and it works to uninstall Edge version 101.0.1210.32 . On the same Windows VM with full windows updates to 2022-Oct, the script fails to remove Edge version 105.0.1343.53. What version of Edge are you testing with?

ShadowWhisperer commented 1 year ago

I tested again this morning on: 107.0.1418.42 (Official build) (64-bit)
Tested on an old VM I've had since 2019, and on a fresh install. (Both fully updated, with VMware tools)

WayneSherman commented 1 year ago

I ran two more tests with the manually installed Edge Business version (installed over the top of the OS provided version):

On Win10 Pro 21H2 with windows updates to 2022-May, it has the OS provided/Win updated Edge ver 101.0.1210.32 (which is removable). I booted the VM without network (so it doesn't try to do any updates) and manually installed "MicrosoftEdgeEnterpriseX64.msi" (Edge for Business) ver 107.0.1418.42. Then I ran your script and Edge gets removed.

On Win10 Pro 21H2 (the same VM as above) with windows updates to 2022-Oct, it has the OS provided/Win updated Edge ver 105.0.1343.53 (which does not remove). I booted the VM without network (so it doesn't try to do any updates) and manually installed "MicrosoftEdgeEnterpriseX64.msi" (Edge for Business) ver 107.0.1418.42. Then I ran your script and Edge does NOT get removed.

WayneSherman commented 1 year ago

Another test starting from Win10 Pro 21H2 with windows updates to 2022-May:

1) In this snapshot, the OS provided/Win updated Edge is ver 101.0.1210.32 which is removable. 2) Boot the VM without network and manually install "MicrosoftEdgeEnterpriseX64.msi" (Edge for Business) ver 107.0.1418.42. (this also is removable) 3) Connect network and perform all Windows updates (but NOT 22H2 feature update). Edge version is still 107.0.1418.42 (Official build) . 4) After the Windows updates (which didn't change the Edge version), running your Edge removal script does NOT uninstall Edge.

So, from this I conclude that it isn't just the version of Edge that prevents removing but something that changed in the Windows updates.

ShadowWhisperer commented 1 year ago

Just ran fine on a new HP Z Workstation. Factory image. Fully updated.
Has to be something related to a Windows file/registry.

baaannnaaannn commented 1 year ago

Another test starting from Win10 Pro 21H2 with windows updates to 2022-May:

1. In this snapshot, the OS provided/Win updated Edge is ver 101.0.1210.32 which is removable.

2. Boot the VM without network and manually install "MicrosoftEdgeEnterpriseX64.msi" ([Edge for Business](https://www.microsoft.com/en-us/edge/business/download?form=MA13FJ)) ver 107.0.1418.42. (this also is removable)

3. Connect network and perform all Windows updates (but NOT 22H2 feature update).  Edge version is still 107.0.1418.42 (Official build) .

4. After the Windows updates (which didn't change the Edge version), running your Edge removal script does NOT uninstall Edge.

So, from this I conclude that it isn't just the version of Edge that prevents removing but something that changed in the Windows updates.

https://www.youtube.com/watch?v=Ol1REx_R3Og try this

WayneSherman commented 1 year ago

@baaannnaaannn wrote:

https://www.youtube.com/watch?v=Ol1REx_R3Og try this

Simply deleting program files, folders, and shortcuts is a naive way to "uninstall" software. The "removeedge.bat" script referenced in the video also removes a single registry key and its values. ( HKLM\SOFTWARE\Microsoft\Active Setup\Installed Components{9459C573-B17A-45AE-9F64-1857B5D58CEE )

But software installers can do many other things that need to be undone. The can install scheduled tasks, services, drivers, Explorer extensions, and perform other system state modifications like register COM objects and type libraries and other registry changes.

Considering the above, deleting the Edge program files actually works better than I expected. A proper uninstaller process is definitely the preferred way to remove software. But if one cannot be found, then a brute force method is better than nothing. The script is a proof of concept, but there is more to be done.

Here are some items I noticed when running:

Edge programs still show up in Add/Remove Programs and Control Panel Program Uninstall.

"MicrosoftEdgeUpdate.exe" process was running preventing some files and folders from being removed.

Deletions in this folder are undone by a system file check repair:
"C:\Windows\SystemApps\Microsoft.MicrosoftEdge_8wekyb3d8bbwe"

sfc /scannow

Windows Resource Protection found corrupt files and successfully repaired them.
For online repairs, details are included in the CBS log file located at
windir\Logs\CBS\CBS.log...

CBS.log:
  Repairing file \??\C:\WINDOWS\SystemApps\Microsoft.MicrosoftEdge_8wekyb3d8bbwe\\AppxManifest.xml from store
  Repairing file \??\C:\WINDOWS\SystemApps\Microsoft.MicrosoftEdge_8wekyb3d8bbwe\\AppxBlockMap.xml from store
  Repairing file \??\C:\WINDOWS\SystemApps\Microsoft.MicrosoftEdge_8wekyb3d8bbwe\\AppxSignature.p7x from store
  Repairing file \??\C:\WINDOWS\SystemApps\Microsoft.MicrosoftEdge_8wekyb3d8bbwe\\resources.pri from store

Files and registry settings associated with these components are still present:

###  Windows Appx Packages  ###
Microsoft.MicrosoftEdge
Microsoft.MicrosoftEdge.Stable
Microsoft.MicrosoftEdgeDevToolsClient
Microsoft.Win32WebViewHost

###  Windows Appx Provisioned Packages  ###
Microsoft.MicrosoftEdge.Stable

###  Windows Services  ###
edgeupdate                                Automatic Microsoft Edge Update Service (edgeupdate)
edgeupdatem                                  Manual Microsoft Edge Update Service (edgeupdatem)
MicrosoftEdgeElevationService                Manual Microsoft Edge Elevation Service (MicrosoftEdgeElevationService)

###  Windows Tasks  ###
\MicrosoftEdgeUpdateTaskMachineCore
\MicrosoftEdgeUpdateTaskMachineUA
Jamskijam commented 1 year ago

I have an idea. Does anyone have an old setup.exe from C:\Program Files\Microsoft\Edge\Application*\Installer or in x64 C:\Program Files (x86)\Microsoft\Edge\Application*\Installer ? I think the problem is in the new setup.exe

reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Microsoft Edge" /t REG_DWORD /v NoRemove /d 0 /f or in x64 reg add "HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Microsoft Edge" /t REG_DWORD /v NoRemove /d 0 /f

Need to copy the old setup.exe and run the uninstall command setup.exe --uninstall --system-level --force-uninstall

Jamskijam commented 1 year ago

HA-HA. BINGOOOOO!!! We just need to put old exe in installer directory and it's WORKING!!! I'm get the old version setup.exe from Win10 21H2. For x86 you need setup.exe from x86 system, for x64 - from x64 system.

WayneSherman commented 1 year ago

HA-HA. BINGOOOOO!!! We just need to put old exe in installer directory and it's WORKING!!! I'm get the old version setup.exe from Win10 21H2. For x86 you need setup.exe from x86 system, for x64 - from x64 system.

I tested this using a setup.exe from 2022-May (Win10 Pro 21H2) (which works for uninstall at that point in time) . I copied to my Win10 Pro VM updated 2022-Oct (also 21H2) and replaced the installers here:

"C:\Program Files (x86)\Microsoft\Edge\Application\105.0.1343.53\Installer\setup.exe" "C:\Program Files (x86)\Microsoft\EdgeCore\105.0.1343.53\Installer\setup.exe"

From an admin command prompt I ran: setup.exe --uninstall --system-level --force-uninstall

Sadly, it does not work for me when running from either location.

Jamskijam commented 1 year ago

After run setup.exe check "Edge\Application" direcrtory. Is still present? I have one PC on which I experimented with uninstalling the edge. Edge was present in "Programs and Features", but uninstall from "Edge\Application" is successfully. I just delete registry key from HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall Every edge keys and it's fine. And i tested on setup.exe 92.0.902.67 version

You can try to give system updating edge to last version and after try to uninstall using old exe

WayneSherman commented 1 year ago

i tested on setup.exe 92.0.902.67 version

For the first tests I used setup.exe from Edge 101.0.1210.32 which did not work.

So I went back further and got setup.exe from Edge 89.0.774.77. I replaced both setup.exe files with the older version in these folders:

"C:\Program Files (x86)\Microsoft\Edge\Application\105.0.1343.53\Installer\setup.exe" "C:\Program Files (x86)\Microsoft\EdgeCore\105.0.1343.53\Installer\setup.exe"

Then I ran the Edge removal script and it worked. Thank you.

EDIT: I also tested the removal script using setup.exe from Edge 96.0.1054.34 and this also works. I think it is better to use the newest setup.exe that works.

WayneSherman commented 1 year ago

For my testing using the older Edge setup.exe to remove a newer Edge, I thought the Edge Updater did not get uninstalled. But I was mistaken. The uninstaller was just taking longer because I have my VM blocked from accessing the internet and the Edge installers / uninstallers send data to MS quite a bit and these connections were stuck and slowing down the uninstall process.

So there is NOT a problem with Edge Updater, it is uninstalling along with the other Edge applications.

ionuttbara commented 1 year ago

so, adding the removal of the edge using old setups, it will solve that problem.

ionuttbara commented 1 year ago

maybe adding the edge 89.x setup.exe and run with parameters will be a good idea i will launch an update for my project after in detail testing.

ionuttbara commented 1 year ago

test this: https://github.com/jbara2002/edge-remover/releases/tag/release2.0

GunGunGun commented 1 year ago

HA-HA. BINGOOOOO!!! We just need to put old exe in installer directory and it's WORKING!!! I'm get the old version setup.exe from Win10 21H2. For x86 you need setup.exe from x86 system, for x64 - from x64 system.

Problem is most of use have already deleted older version of Edge, I'm also locked out of this solution because of Edge 108 overrided my older Edge, so no setup.exe for me to use...

Is there a way to easily get the official setup.exe to uninstall Edge, I'll back it up very carefully this time and write a full fledged uninstaller from it, it's much safer than writting Edge Uninstaller from scratch.

P/s: Installing Windows 10 21H2 to a Virtual Machine then copy and backup setup.exe seems to be my only choice, will take time.

WayneSherman commented 1 year ago

"setup.exe" file from the Microsoft Edge 96.0.1054.34 installation on Windows 10

VirusTotal.com report: https://www.virustotal.com/gui/file/ac073eed9f8f213651753081f0a39567fba11c61767c7ddf217ee56bed8390a8

File was located here: "C:\Program Files (x86)\Microsoft\Edge\Application\96.0.1054.34\Installer\setup.exe"

The exact same file is also here: C:\Program Files (x86)\Microsoft\EdgeCore\96.0.1054.34\Installer\setup.exe"

GunGunGun commented 1 year ago

This is the unmodified "setup.exe" file from the Microsoft Edge 96.0.1054.34 installation on Windows 10

VirusTotal.com report: https://www.virustotal.com/gui/file/ac073eed9f8f213651753081f0a39567fba11c61767c7ddf217ee56bed8390a8

File was taken from here: "C:\Program Files (x86)\Microsoft\Edge\Application\96.0.1054.34\Installer\setup.exe"

The exact same file is also here: C:\Program Files (x86)\Microsoft\EdgeCore\96.0.1054.34\Installer\setup.exe"

https://drive.google.com/drive/folders/1JwFytQYoFE2ku9Pn25ijzygcOQrvAyqP?usp=share_link

Thank you a lot, time to nuke Egde out of my computer and block their update server forever, free 500MB of hard drive is good.

ShadowWhisperer commented 1 year ago

Good news!

I finally got a system in that was erroring out. .exe has been updated, and working.