ChromeEdgeCleaner

Welcome!
This utility helps system administrators quickly clear cache, cookies, history, and temp files from both Chrome and Edge using PowerShell—ideal for troubleshooting browser issues or prepping a machine for user handoff.

Description:
This script uses file system paths and environment variables to remove temporary internet files, browsing history, and cached data from both Microsoft Edge and Google Chrome. It is especially useful in enterprise environments for periodic cleanup or pre-deployment routines.

# Clear Chrome browser data
$chromePaths = @(
    "$env:LOCALAPPDATA\Google\Chrome\User Data\Default\Cache",
    "$env:LOCALAPPDATA\Google\Chrome\User Data\Default\Code Cache",
    "$env:LOCALAPPDATA\Google\Chrome\User Data\Default\Cookies",
    "$env:LOCALAPPDATA\Google\Chrome\User Data\Default\History",
    "$env:LOCALAPPDATA\Google\Chrome\User Data\Default\Temp"
)
foreach ($path in $chromePaths) {
    if (Test-Path $path) {
        Remove-Item $path -Recurse -Force -ErrorAction SilentlyContinue
    }
}

# Clear Edge browser data
$edgePaths = @(
    "$env:LOCALAPPDATA\Microsoft\Edge\User Data\Default\Cache",
    "$env:LOCALAPPDATA\Microsoft\Edge\User Data\Default\Code Cache",
    "$env:LOCALAPPDATA\Microsoft\Edge\User Data\Default\Cookies",
    "$env:LOCALAPPDATA\Microsoft\Edge\User Data\Default\History",
    "$env:LOCALAPPDATA\Microsoft\Edge\User Data\Default\Temp"
)
foreach ($path in $edgePaths) {
    if (Test-Path $path) {
        Remove-Item $path -Recurse -Force -ErrorAction SilentlyContinue
    }
}

Notes:

  • Best run with administrative privileges.
  • Does not remove saved passwords or extensions.
  • Can be scheduled via Task Scheduler for weekly cleanup.

🔗 View on GitHub

© 2012–2025 Jet Mariano. All rights reserved.

For usage terms, please see the Legal Disclaimer.

error: Content is protected !!