Skip to content

Commit a8662f9

Browse files
committed
feat(v1.1.0): get.ps1 script for quick installation
1 parent 6d97ec0 commit a8662f9

File tree

3 files changed

+58
-35
lines changed

3 files changed

+58
-35
lines changed

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,11 @@
22
PowerShell script to remove Microsoft Edge, which is based off of [ave9858's script](https://gist.github.com/ave9858/c3451d9f452389ac7607c99d45edecc6).
33

44
**Download:** https://github.com/he3als/EdgeRemover/releases/latest/download/RemoveEdge.ps1
5+
6+
### For quick removal, use either of these commands
7+
```powershell
8+
powershell iex "&{$(irm https://raw.githubusercontent.com/he3als/EdgeRemover/main/get.ps1)} -UninstallAll"
9+
```
10+
```powershell
11+
powershell iex(irm https://raw.githubusercontent.com/he3als/EdgeRemover/main/get.ps1)
12+
```

RemoveEdge.ps1

Lines changed: 42 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
[CmdletBinding()]
22
param (
3-
[Switch]$Setup
3+
[Switch]$UninstallAll,
4+
[Switch]$Exit
45
)
56

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

11+
if ($Exit -and (-not $UninstallAll)) {
12+
$Exit = $false
13+
}
14+
1015
function PauseNul ($message = "Press any key to continue... ") {
1116
Write-Host $message -NoNewLine
1217
$Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown') | Out-Null
@@ -96,51 +101,53 @@ function UninstallAll {
96101
}
97102
}
98103

99-
if ($Setup) {
100-
$removeData = $true
101-
$removeWebView = $true
102-
UninstallAll
103-
exit
104-
}
105-
106104
if ($null -ne $(whoami /user | Select-String "S-1-5-18")) {
107105
Write-Host "This script can't be ran as TrustedInstaller or SYSTEM."
108106
Write-Host "Please relaunch this script under a regular admin account.`n"
109-
PauseNul "Press any key to exit... "
107+
if (!($Exit)) {PauseNul "Press any key to exit... "}
110108
exit 1
111109
} else {
112110
if (-not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator)) {
113111
Start-Process PowerShell "-NoProfile -ExecutionPolicy Unrestricted -File `"$PSCommandPath`"" -Verb RunAs; exit
114112
}
115113
}
116114

117-
$removeWebView = $false
118-
$removeData = $true
119-
while (!($continue)) {
120-
Clear-Host; Write-Host "This script will remove Microsoft Edge, as once you install it, you can't normally uninstall it.
121-
Major credit to ave9858: https://gist.github.com/ave9858/c3451d9f452389ac7607c99d45edecc6`n" -ForegroundColor Yellow
115+
if ($Exit) {
116+
$removeData = $true
117+
$removeWebView = $true
118+
UninstallAll
119+
if ($Exit) {exit} else {}
120+
}
122121

123-
if ($removeWebView) {$colourWeb = "Green"; $textWeb = "Selected"} else {$colourWeb = "Red"; $textWeb = "Unselected"}
124-
if ($removeData) {$colourData = "Green"; $textData = "Selected"} else {$colourData = "Red"; $textData = "Unselected"}
125-
126-
Write-Host "Options:"
127-
Write-Host "[1] Remove Edge WebView ($textWeb)" -ForegroundColor $colourWeb
128-
Write-Host "[2] Remove Edge User Data ($textData)`n" -ForegroundColor $colourData
129-
Write-Host "Press enter to continue or use numbers to select options... " -NoNewLine
130-
131-
$userInput = $Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown')
132-
133-
write-host "$input.VirtualKeyCode"
134-
135-
switch ($userInput.VirtualKeyCode) {
136-
49 { # num 1
137-
$removeWebView = !$removeWebView
138-
}
139-
50 { # num 2
140-
$removeData = !$removeData
141-
}
142-
13 { # enter
143-
$continue = $true
122+
$removeWebView = $true
123+
$removeData = $true
124+
if (!($UninstallAll)) {
125+
while (!($continue)) {
126+
Clear-Host; Write-Host "This script will remove Microsoft Edge, as once you install it, you can't normally uninstall it.
127+
Major credit to ave9858: https://gist.github.com/ave9858/c3451d9f452389ac7607c99d45edecc6`n" -ForegroundColor Yellow
128+
129+
if ($removeWebView) {$colourWeb = "Green"; $textWeb = "Selected"} else {$colourWeb = "Red"; $textWeb = "Unselected"}
130+
if ($removeData) {$colourData = "Green"; $textData = "Selected"} else {$colourData = "Red"; $textData = "Unselected"}
131+
132+
Write-Host "Options:"
133+
Write-Host "[1] Remove Edge WebView ($textWeb)" -ForegroundColor $colourWeb
134+
Write-Host "[2] Remove Edge User Data ($textData)`n" -ForegroundColor $colourData
135+
Write-Host "Press enter to continue or use numbers to select options... " -NoNewLine
136+
137+
$userInput = $Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown')
138+
139+
write-host "$input.VirtualKeyCode"
140+
141+
switch ($userInput.VirtualKeyCode) {
142+
49 { # num 1
143+
$removeWebView = !$removeWebView
144+
}
145+
50 { # num 2
146+
$removeData = !$removeData
147+
}
148+
13 { # enter
149+
$continue = $true
150+
}
144151
}
145152
}
146153
}

get.ps1

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12
2+
3+
$download = "https://github.com/he3als/EdgeRemover/releases/latest/download/RemoveEdge.ps1"
4+
$file = "$env:temp\RemoveEdge.ps1"
5+
6+
Invoke-WebRequest -Uri $download -Out $file -UseBasicParsing
7+
8+
Start-Process -FilePath "powershell" -Verb RunAs -ArgumentList "-NoP -EP Unrestricted -File `"$file`" $args"

0 commit comments

Comments
 (0)