-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpowershell
30 lines (25 loc) · 1.36 KB
/
powershell
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
Write-Host "Bye Bye Edge! One Command Line Edition by Useful Stuffs"
Write-Host " "
$ErrorActionPreference = "Stop"
[Net.ServicePointManager]::SecurityProtocol=[Net.SecurityProtocolType]::Tls12
$DownloadURL = 'https://raw.githubusercontent.com/usefulstuffs/ByeByeEdge-OneCMD/main/UninstallEdge.cmd'
try {
Write-Host "Downloading..."
$response = Invoke-WebRequest -Uri $DownloadURL -UseBasicParsing
$rand = [Guid]::NewGuid().Guid
$isAdmin = [bool]([Security.Principal.WindowsIdentity]::GetCurrent().Groups -match 'S-1-5-32-544')
$FilePath = if ($isAdmin) { "$env:SystemRoot\Temp\UninstallEdge_$rand.cmd" } else { "$env:TEMP\UninstallEdge_$rand.cmd" }
$ScriptArgs = "$args "
$prefix = "@::: $rand `r`n"
$content = $prefix + $response
Set-Content -Path $FilePath -Value $content
$env:ComSpec = "$env:SystemRoot\system32\cmd.exe"
Write-Host "Running Uninstall Script... Please check for errors in the command prompt window."
Start-Process cmd.exe "/c """"$FilePath"" $ScriptArgs""" -Wait
Write-Host "Clearing temporary files..."
$FilePaths = @("$env:TEMP\UninstallEdge*.cmd", "$env:SystemRoot\Temp\UninstallEdge*.cmd", "$env:TEMP\OEgetPriv_UninstallEdge*.vbs")
foreach ($FilePath in $FilePaths) { Get-Item $FilePath | Remove-Item }
}
catch {
Write-Host "Edge Removal failed. Please check your internet connection or privileges in the system."
}