Skip to content

Instantly share code, notes, and snippets.

@thecatontheceiling
Created September 5, 2023 15:42
Show Gist options
  • Save thecatontheceiling/07a72f91fedd3f11395da7fd64426b87 to your computer and use it in GitHub Desktop.
Save thecatontheceiling/07a72f91fedd3f11395da7fd64426b87 to your computer and use it in GitHub Desktop.
lmao
# set the registry view to 32-bit
$regView = [Microsoft.Win32.RegistryView]::Registry32
# open the SOFTWARE\Microsoft key in the LocalMachine hive
$microsoft = [Microsoft.Win32.RegistryKey]::OpenBaseKey([Microsoft.Win32.RegistryHive]::LocalMachine, $regView).OpenSubKey('SOFTWARE\Microsoft', $true)
# open the EdgeUpdate\ClientState\{56EB18F8-B008-4CBD-B6D2-8C97FE7E9062} key
$edgeClient = $microsoft.OpenSubKey('EdgeUpdate\ClientState\{56EB18F8-B008-4CBD-B6D2-8C97FE7E9062}', $true)
# check if the experiment_control_labels value exists and delete it if it does
if ($null -ne $edgeClient.GetValue('experiment_control_labels')) {
$edgeClient.DeleteValue('experiment_control_labels')
}
# create the EdgeUpdateDev key and set the AllowUninstall value to an empty string
$microsoft.CreateSubKey('EdgeUpdateDev').SetValue('AllowUninstall', '')
# open the Windows\CurrentVersion\Uninstall\Microsoft Edge key and get the UninstallString value
$uninstallRegKey = $microsoft.OpenSubKey('Windows\CurrentVersion\Uninstall\Microsoft Edge')
# append --force-uninstall to the UninstallString value and start a cmd.exe process with it
$uninstallString = $uninstallRegKey.GetValue('UninstallString') + ' --force-uninstall'
Start-Process cmd.exe "/c $uninstallString" -WindowStyle Hidden
# set the path to the AppxAllUserStore key
$appxStore = '\SOFTWARE\Microsoft\Windows\CurrentVersion\Appx\AppxAllUserStore'
# set the pattern for the Microsoft Edge InboxApplications key
$pattern = "HKLM:$appxStore\InboxApplications\Microsoft.MicrosoftEdge_*_neutral__8wekyb3d8bbwe"
# get the name of the Microsoft Edge InboxApplications key
$key = (Get-Item -Path $pattern).PSChildName
# delete the Microsoft Edge InboxApplications key
reg delete "HKLM$appxStore\InboxApplications\$key" /f
# get the Security Identifier (SID) for the current user
$SID = (New-Object System.Security.Principal.NTAccount($env:USERNAME)).Translate([Security.Principal.SecurityIdentifier]).Value
# create a new EndOfLife key for Microsoft Edge
New-Item -Path "HKLM:$appxStore\EndOfLife\$SID\Microsoft.MicrosoftEdge_8wekyb3d8bbwe" -Force
# get the Microsoft Edge AppxPackage and remove it
Get-AppxPackage -Name Microsoft.MicrosoftEdge | Remove-AppxPackage
# remove the Microsoft Edge EndOfLife key created earlier, breaks windows update if you keep it after removal
Remove-Item -Path "HKLM:$appxStore\EndOfLife\$SID\Microsoft.MicrosoftEdge_8wekyb3d8bbwe"
# output a message to indicate that Microsoft Edge has been uninstalled
Write-Output "edge should now be dead!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment