Skip to content

Instantly share code, notes, and snippets.

@eebssk1
Last active July 16, 2023 06:48
Show Gist options
  • Save eebssk1/8154f9253a58ebf056cca87a751843cd to your computer and use it in GitHub Desktop.
Save eebssk1/8154f9253a58ebf056cca87a751843cd to your computer and use it in GitHub Desktop.
Fully uninstall Microsoft edge with one simple script (iso preinstalled only)
FOR /F %%I IN ('dir /B "C:\Program Files (x86)\Microsoft\Edge\Application" ^| findstr [0-9]') DO set a=%%I
echo find is %a%
set b="C:\Program Files (x86)\Microsoft\Edge\Application\%a%\Installer\setup.exe"
%b% --uninstall --force-uninstall --system-level --delete-profile
rmdir /s /q "C:\Program Files (x86)\Microsoft\Edge"
for /f "tokens=8 delims=\" %%T in ('reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages" ^| findstr "Microsoft-Windows-Internet-Browser-Package" ^| findstr "~~"') do (set "edge_legacy_package_version=%%T")
if defined edge_legacy_package_version (
echo Removing %edge_legacy_package_version%...
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\%edge_legacy_package_version%" /v Visibility /t REG_DWORD /d 1 /f
reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\%edge_legacy_package_version%\Owners" /va /f
dism /online /Remove-Package /PackageName:%edge_legacy_package_version%
powershell.exe -Command "Get-AppxPackage *edge* | Remove-AppxPackage" >nul
)
schtasks /Change /TN "\MicrosoftEdgeUpdateTaskMachineUA" /Disable
sc config "edgeupdate" start=disabled
sc config "edgeupdatem" start=disabled
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment