Skip to content

Commit

Permalink
feat(v1.1.0): get.ps1 script for quick installation
Browse files Browse the repository at this point in the history
  • Loading branch information
he3als committed Aug 4, 2023
1 parent 6d97ec0 commit a8662f9
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 35 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,11 @@
PowerShell script to remove Microsoft Edge, which is based off of [ave9858's script](https://gist.github.com/ave9858/c3451d9f452389ac7607c99d45edecc6).

**Download:** https://github.com/he3als/EdgeRemover/releases/latest/download/RemoveEdge.ps1

### For quick removal, use either of these commands
```powershell
powershell iex "&{$(irm https://raw.githubusercontent.com/he3als/EdgeRemover/main/get.ps1)} -UninstallAll"
```
```powershell
powershell iex(irm https://raw.githubusercontent.com/he3als/EdgeRemover/main/get.ps1)
```
77 changes: 42 additions & 35 deletions RemoveEdge.ps1
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
[CmdletBinding()]
param (
[Switch]$Setup
[Switch]$UninstallAll,
[Switch]$Exit
)

$ProgressPreference = "SilentlyContinue"
$user = $env:USERNAME
$SID = (New-Object System.Security.Principal.NTAccount($user)).Translate([Security.Principal.SecurityIdentifier]).Value

if ($Exit -and (-not $UninstallAll)) {
$Exit = $false
}

function PauseNul ($message = "Press any key to continue... ") {
Write-Host $message -NoNewLine
$Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown') | Out-Null
Expand Down Expand Up @@ -96,51 +101,53 @@ function UninstallAll {
}
}

if ($Setup) {
$removeData = $true
$removeWebView = $true
UninstallAll
exit
}

if ($null -ne $(whoami /user | Select-String "S-1-5-18")) {
Write-Host "This script can't be ran as TrustedInstaller or SYSTEM."
Write-Host "Please relaunch this script under a regular admin account.`n"
PauseNul "Press any key to exit... "
if (!($Exit)) {PauseNul "Press any key to exit... "}
exit 1
} else {
if (-not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator)) {
Start-Process PowerShell "-NoProfile -ExecutionPolicy Unrestricted -File `"$PSCommandPath`"" -Verb RunAs; exit
}
}

$removeWebView = $false
$removeData = $true
while (!($continue)) {
Clear-Host; 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 ($Exit) {
$removeData = $true
$removeWebView = $true
UninstallAll
if ($Exit) {exit} else {}
}

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 ($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

$userInput = $Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown')

write-host "$input.VirtualKeyCode"

switch ($userInput.VirtualKeyCode) {
49 { # num 1
$removeWebView = !$removeWebView
}
50 { # num 2
$removeData = !$removeData
}
13 { # enter
$continue = $true
$removeWebView = $true
$removeData = $true
if (!($UninstallAll)) {
while (!($continue)) {
Clear-Host; 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) {$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 ($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

$userInput = $Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown')

write-host "$input.VirtualKeyCode"

switch ($userInput.VirtualKeyCode) {
49 { # num 1
$removeWebView = !$removeWebView
}
50 { # num 2
$removeData = !$removeData
}
13 { # enter
$continue = $true
}
}
}
}
Expand Down
8 changes: 8 additions & 0 deletions get.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12

$download = "https://github.com/he3als/EdgeRemover/releases/latest/download/RemoveEdge.ps1"
$file = "$env:temp\RemoveEdge.ps1"

Invoke-WebRequest -Uri $download -Out $file -UseBasicParsing

Start-Process -FilePath "powershell" -Verb RunAs -ArgumentList "-NoP -EP Unrestricted -File `"$file`" $args"

0 comments on commit a8662f9

Please sign in to comment.