Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Edge removal improvements #2540

Merged
merged 4 commits into from
Aug 13, 2024
Merged

Conversation

MyDrift-user
Copy link
Contributor

@MyDrift-user MyDrift-user commented Aug 8, 2024

Pull Request

Edge removal improvements

Type of Change

  • Refactoring
  • Hotfix

Description

  • added working logic to reinstall MS Edge
  • added logic to remove more reg keys on removal
    • with those two reg removals edge does not give the big annoying welcome back screen but a "better" (still annoying) popup. It also offers a more clean uninstallation.
  • fixed "open with" context menu having broken edge option bc MS Edge can't make a working uninstaller.
    Screenshot 2024-08-08 111912

Testing

changes were tested on vm, run & undo work without sys/ep restart needed

Checklist

  • My code adheres to the coding and style guidelines of the project.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation.
  • My changes generate no errors/warnings/merge conflicts.

Copy link
Owner

@ChrisTitusTech ChrisTitusTech left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had problems even with the force. I think we might have to download the EXE directly and set it up that way or use chocolatey as a backup.
Need to expand the remove item property to strip out any Edge Policies if they exist.

@MyDrift-user
Copy link
Contributor Author

MyDrift-user commented Aug 8, 2024

I had problems even with the force. I think we might have to download the EXE directly and set it up that way or use chocolatey as a backup. Need to expand the remove item property to strip out any Edge Policies if they exist.

Yeah that was the only way I was able to correctly reinstall edge without any known issues. did try to implement it in the script for a moment but got fed up with this message so i stopped with it for the moment, will reimplement it correctly and commit the requested change :)
image

@MyDrift-user MyDrift-user marked this pull request as draft August 8, 2024 17:54
- change uninstall function call
- remove winget install code
- add edge install function call

- remove reg keys causing cursed open with contect menu
- remove edge policy keys
- remove edge keys
- remove edgeupdate keys
- add install edg logics
@MyDrift-user MyDrift-user reopened this Aug 8, 2024
@MyDrift-user MyDrift-user marked this pull request as ready for review August 8, 2024 19:13
@psyirius
Copy link
Contributor

psyirius commented Aug 8, 2024

I've personally uninstalled Edge using method in a fresh windows 24H2 install and I was able to uninstall it with all the files removed from fs as well as registry.

Check the log at %TEMP%/msedge_installer.log if there is smth wrong.

You can get a detailed view of what's getting added extra apart from the base installation files from the log of a clean install of windows which has Edge Pre-Installed.

You can also get a detailed view of what's getting removed from the log of a clean uninstall using the setup. (a vm with EEA countries).

NOTE: don't delete keys that have a name edge on it blindly. look for the dependencies and clean it properly.

PS: I might raise a PR with my whole script (wip - needs spare time) to wipe edge in whatever state without the help of its setup.

@psyirius
Copy link
Contributor

psyirius commented Aug 8, 2024

I had this planned for the micro-win stream. But @ChrisTitusTech didn't make it 😒

function Remove-Edge {
    Write-Host "$([char]0x1b)[48;2;20;14;136m=== Removing Microsoft Edge"

    reg load "HKLM\zSOFTWARE" "$mountDir\Windows\System32\config\SOFTWARE" | Out-Null
    reg load "HKLM\zSYSTEM" "$mountDir\Windows\System32\config\SYSTEM" | Out-Null
    reg load "HKLM\zNTUSER" "$mountDir\Users\Default\ntuser.dat" | Out-Null

    # Microsoft Edge
    reg delete "HKLM\zSOFTWARE\Microsoft\Active Setup\Installed Components\{9459C573-B17A-45AE-9F64-1857B5D58CEE}" /f | Out-Null

    reg delete "HKLM\zSOFTWARE\Wow6432Node\Microsoft\EdgeUpdate\Clients\{56EB18F8-B008-4CBD-B6D2-8C97FE7E9062}" /f | Out-Null
    reg delete "HKLM\zSOFTWARE\Wow6432Node\Microsoft\EdgeUpdate\ClientState\{56EB18F8-B008-4CBD-B6D2-8C97FE7E9062}" /f | Out-Null

    reg delete "HKLM\zSOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Microsoft Edge" /f | Out-Null

    if (Test-Path "$mountDir\Program Files (x86)\Microsoft\Edge" -Type Container) {
        Remove-Item "$mountDir\Program Files (x86)\Microsoft\Edge" -Recurse -Force | Out-Null
    }

    # Extra
    reg delete "HKLM\zSOFTWARE\Microsoft\MicrosoftEdge" /f | Out-Null

    # Microsoft EdgeWebView
    reg delete "HKLM\zSOFTWARE\Wow6432Node\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}" /f | Out-Null
    reg delete "HKLM\zSOFTWARE\Wow6432Node\Microsoft\EdgeUpdate\ClientState\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}" /f | Out-Null

    reg delete "HKLM\zSOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Microsoft EdgeWebView" /f | Out-Null

    if (Test-Path "$mountDir\Program Files (x86)\Microsoft\EdgeWebView" -Type Container) {
        Remove-Item "$mountDir\Program Files (x86)\Microsoft\EdgeWebView" -Recurse -Force | Out-Null
    }

    # Edge Core
    if (Test-Path "$mountDir\Program Files (x86)\Microsoft\EdgeCore" -Type Container) {
        Remove-Item "$mountDir\Program Files (x86)\Microsoft\EdgeCore" -Recurse -Force | Out-Null
    }

    # Microsoft Edge Update
    reg delete "HKLM\zSOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\MicrosoftEdgeUpdate.exe" /f | Out-Null

    reg delete "HKLM\zSOFTWARE\Wow6432Node\Microsoft\EdgeUpdate" /f | Out-Null
    reg delete "HKLM\zSOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Microsoft Edge Update" /f | Out-Null

    # Microsoft Edge Update :: Services
    reg delete "HKLM\zSYSTEM\ControlSet001\Services\edgeupdate" /f | Out-Null
    reg delete "HKLM\zSYSTEM\ControlSet001\Services\edgeupdatem" /f | Out-Null

    if (Test-Path "$mountDir\Program Files (x86)\Microsoft\EdgeUpdate" -Type Container) {
        Remove-Item "$mountDir\Program Files (x86)\Microsoft\EdgeUpdate" -Recurse -Force | Out-Null
    }

    # Prevent EdgeChromium from Installing in the future
    reg add "HKLM\zSOFTWARE\Microsoft\EdgeUpdate" /v "DoNotUpdateToEdgeWithChromium" /t REG_DWORD /d "1" /f | Out-Null

    reg unload "HKLM\zSOFTWARE" | Out-Null
    reg unload "HKLM\zSYSTEM" | Out-Null
    reg unload "HKLM\zNTUSER" | Out-Null

    Write-Host
}

Here is a function that removes edge from an offline windows image.

When on first boot edge sets up extra stuff like shortcuts, assocs, etc (which you can find the details in the log)

SideNote: EdgeUpdate is like the host app, where Edge and WebView are their clients which it makes up-to-date

@MyDrift-user
Copy link
Contributor Author

Isn't edge core also a compatibility layer for webview?

@psyirius
Copy link
Contributor

psyirius commented Aug 9, 2024

Isn't edge core also a compatibility layer for webview?

It's a shared components used by both edge and webview. (Mostly webview).

@psyirius
Copy link
Contributor

psyirius commented Aug 9, 2024

Also, EdgeUpdate might not uninstall if EdgeWebview is still installed in some cases.

Copy link
Owner

@ChrisTitusTech ChrisTitusTech left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, that will fix a lot of edge user issue on reinstall doing it this method as well.

@ChrisTitusTech ChrisTitusTech merged commit 6c3539e into ChrisTitusTech:main Aug 13, 2024
1 check passed
@ChrisTitusTech ChrisTitusTech added the skip-changelog Skip Change Logs label Sep 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip-changelog Skip Change Logs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants