Skip to content

Commit 96232f9

Browse files
committed
fix(v1.0.1): TI AppX uninstall & formatting
1 parent 9eb4fac commit 96232f9

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

RemoveEdge.ps1

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ function RemoveEdgeChromium {
5353
$valueName = "experiment_control_labels"
5454
if (Test-Path $keyPath) {
5555
$valueExists = Get-ItemProperty -Path $keyPath -Name $valueName -ErrorAction SilentlyContinue
56-
if ($valueExists -ne $null) {
56+
if ($null -ne $valueExists) {
5757
Remove-ItemProperty -Path $keyPath -Name $valueName -Force | Out-Null
5858
}
5959
}
@@ -89,7 +89,7 @@ function RemoveEdgeAppX {
8989

9090
# make the Edge AppX able to uninstall and uninstall
9191
$user = (Get-CimInstance -ClassName Win32_ComputerSystem | Select-Object -ExpandProperty UserName) -replace ".*\\"
92-
$SID = (New-Object System.Security.Principal.NTAccount($env:USERNAME)).Translate([Security.Principal.SecurityIdentifier]).Value
92+
$SID = (New-Object System.Security.Principal.NTAccount($user)).Translate([Security.Principal.SecurityIdentifier]).Value
9393
New-Item -Path "HKLM:$appxStore\EndOfLife\$SID\Microsoft.MicrosoftEdge_8wekyb3d8bbwe" -Force | Out-Null
9494
Get-AppxPackage -Name Microsoft.MicrosoftEdge | Remove-AppxPackage | Out-Null
9595
Remove-Item -Path "HKLM:$appxStore\EndOfLife\$SID\Microsoft.MicrosoftEdge_8wekyb3d8bbwe" -Force | Out-Null
@@ -135,7 +135,7 @@ if (-not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdent
135135
Start-Process PowerShell "-NoProfile -ExecutionPolicy Unrestricted -File `"$PSCommandPath`"" -Verb RunAs; exit
136136
}
137137

138-
if ($(whoami /user | Select-String "S-1-5-18") -ne $null) {
138+
if ($null -ne $(whoami /user | Select-String "S-1-5-18")) {
139139
Write-Host "This script can't be ran as TrustedInstaller or SYSTEM."
140140
Write-Host "Please relaunch this script under a regular admin account.`n"
141141
PauseNul "Press any key to exit... "
@@ -145,7 +145,7 @@ if ($(whoami /user | Select-String "S-1-5-18") -ne $null) {
145145
$removeWebView = $false
146146
$removeData = $true
147147
while (!($continue)) {
148-
cls; Write-Host "This script will remove Microsoft Edge, as once you install it, you can't normally uninstall it.
148+
Clear-Host; Write-Host "This script will remove Microsoft Edge, as once you install it, you can't normally uninstall it.
149149
Major credit to ave9858: https://gist.github.com/ave9858/c3451d9f452389ac7607c99d45edecc6`n" -ForegroundColor Yellow
150150

151151
if ($removeWebView) {$colourWeb = "Green"; $textWeb = "Selected"} else {$colourWeb = "Red"; $textWeb = "Unselected"}
@@ -173,7 +173,7 @@ Major credit to ave9858: https://gist.github.com/ave9858/c3451d9f452389ac7607c99
173173
}
174174
}
175175

176-
cls; UninstallAll
176+
Clear-Host; UninstallAll
177177

178178
Write-Host "`nCompleted." -ForegroundColor Green
179179
PauseNul "Press any key to exit... "

0 commit comments

Comments
 (0)