Removing Microsoft Edge using PowerShell

less than 1 minute read

Locate setup.exe

First locate the setup.exe file, which will be used to uninstall Microsoft Edge.

You should be able to find it in the path below:

 ๐Ÿ’ฝ C:
    โ””โ”€โ”€ ๐Ÿ“‚Program Files (x86)
        โ””โ”€โ”€ ๐Ÿ“‚Microsoft
            โ””โ”€โ”€ ๐Ÿ“‚Edge
                โ””โ”€โ”€ ๐Ÿ“‚Application
                    โ””โ”€โ”€ ๐Ÿ“‚<version number>
                        โ””โ”€โ”€ ๐Ÿ“‚Installer
                            โ”œโ”€โ”€ ...
                            โ””โ”€โ”€ โš™๏ธsetup.exe ๐Ÿ‘ˆ

For example: C:\Program Files (x86)\Microsoft\Edge\Application\96.0.1054.34\Installer.

PowerShell script

The below script will uninstall Microsoft Edge stable channel:

$EdgeVersion = (Get-AppxPackage "Microsoft.MicrosoftEdge.Stable" -AllUsers).Version
$EdgeSetupPath = ${env:ProgramFiles(x86)} + '\Microsoft\Edge\Application\' + $EdgeVersion + '\Installer\setup.exe'
& $EdgeSetupPath --uninstall --system-level --verbose-logging --force-uninstall

Copy and paste the above script, launch Windows PowerShell ISE as an Administrator and execute using the โ–ถ๏ธ Run Script button, or hit F5.

powershell-ise

Some more details on each step can be found below.

Steps explained

Use the Get-AppxPackage function to retrieve the Microsoft Edge version number:

$EdgeVersion = (Get-AppxPackage "Microsoft.MicrosoftEdge.Stable" -AllUsers).Version

Construct the absolute path which contains the setup.exe file:

$EdgeSetupPath = ${env:ProgramFiles(x86)} + '\Microsoft\Edge\Application\' + $EdgeVersion + '\Installer\setup.exe'

Use the Call operator &, to run the actual uninstall operation and add the following ๐Ÿšฉflags:

  • --uninstall
  • --system-level
  • --verbose-logging
  • --force-uninstall
& $EdgeSetupPath --uninstall --system-level --verbose-logging --force-uninstall

and-its-gone

Comments