PowerShell Script to Remove ALL Chrome and Edge Browser Extentions
To remove all browser extensions from Google Chrome and Microsoft Edge using PowerShell, we can target the directories where extensions are stored for each browser. Here’s a script that removes the extension folders for both browsers:
# Define paths to extension directories for Chrome and Edge
$chromeExtPath = "$env:LOCALAPPDATA\Google\Chrome\User Data\Default\Extensions"
$edgeExtPath = "$env:LOCALAPPDATA\Microsoft\Edge\User Data\Default\Extensions"
# Function to remove extensions
function Remove-BrowserExtensions {
param (
[string]$extPath
)
if (Test-Path $extPath) {
Write-Host "Removing extensions from: $extPath"
Get-ChildItem -Path $extPath | ForEach-Object {
Remove-Item -Path $_.FullName -Recurse -Force
}
Write-Host "Extensions removed from $extPath"
} else {
Write-Host "$extPath does not exist or no extensions found."
}
}
# Remove extensions for Chrome
Remove-BrowserExtensions -extPath $chromeExtPath
# Remove extensions for Edge
Remove-BrowserExtensions -extPath $edgeExtPath
Write-Host "All browser extensions removed for Chrome and Edge."
How it works:
- Chrome Extension Path: Extensions for Chrome are usually stored in the directory:
C:\Users\<username>\AppData\Local\Google\Chrome\User Data\Default\Extensions
- Edge Extension Path: Extensions for Edge are stored similarly:
C:\Users\<username>\AppData\Local\Microsoft\Edge\User Data\Default\Extensions
- PowerShell Script: The script checks if the extension folders exist and, if so, deletes all contents (extensions) in those directories.
Notes:
- This script assumes you’re targeting the “Default” profile. If you’re using multiple profiles, you’ll need to adjust the paths accordingly.
- Use with caution, as this script will remove all extensions without confirmation.