Removing Microsoft Edge using PowerShell
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
.
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
Comments