Skip to content

Commit

Permalink
feat(edge): remove user data option
Browse files Browse the repository at this point in the history
  • Loading branch information
he3als committed Jul 11, 2023
1 parent bd09291 commit 50812f1
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions src/Executables/Atlas/1. Software/Remove Edge.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ function RemoveEdgeChromium {
$uninstallString = (Get-ItemProperty -Path $uninstallKeyPath).UninstallString
Start-Process cmd.exe "/c $uninstallString --force-uninstall" -WindowStyle Hidden
}

# remove user data
if ($removeData) {
$path = "$env:LOCALAPPDATA\Microsoft\Edge"
if (Test-Path $path) {Remove-Item $path -Force -Recurse}
}
}

function RemoveEdgeAppX {
Expand Down Expand Up @@ -71,6 +77,7 @@ function UninstallAll {

if ($RemoveAllEdge) {
$removeWebView = $true
$removeData = $true
UninstallAll
}

Expand All @@ -79,21 +86,18 @@ if (-not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdent
}

$removeWebView = $false
$removeData = $true
while (!($continue)) {
cls
Write-Host "This script will remove Microsoft Edge, as once you install it, you can't normally uninstall it.
Major credit to ave9858: https://gist.github.com/ave9858/c3451d9f452389ac7607c99d45edecc6`n" -ForegroundColor Yellow

if ($removeWebView) {
$colour = "Green"
$text = "Selected"
} else {
$colour = "Red"
$text = "Unselected"
}
if ($removeWebView) {$colourWeb = "Green"; $textWeb = "Selected"} else {$colourWeb = "Red"; $textWeb = "Unselected"}
if ($removeData) {$colourData = "Green"; $textData = "Selected"} else {$colourData = "Red"; $textData = "Unselected"}

Write-Host "Options:"
Write-Host "[1] Remove Edge WebView ($text)`n" -ForegroundColor $colour
Write-Host "[1] Remove Edge WebView ($textWeb)" -ForegroundColor $colourWeb
Write-Host "[2] Remove Edge User Data ($textData)`n" -ForegroundColor $colourData
Write-Host "Press enter to continue or use numbers to select options... " -NoNewLine

$input = $Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown')
Expand All @@ -104,14 +108,16 @@ Major credit to ave9858: https://gist.github.com/ave9858/c3451d9f452389ac7607c99
49 { # num 1
$removeWebView = !$removeWebView
}
50 { # num 2
$removeData = !$removeData
}
13 { # enter
$continue = $true
}
}
}

cls
UninstallAll
cls; UninstallAll

Write-Host "`nCompleted." -ForegroundColor Green
PauseNul "Press any key to exit... "
Expand Down

0 comments on commit 50812f1

Please sign in to comment.