mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2024-11-14 22:55:52 -06:00
EdgeRemoval optimization and refactor (from stream today: Techie Jack) (#2530)
* Gracefully nuke Edge and all its associates completely. - me: same person from the stream chat today: Techie Jack (aka: Psyirius) - cleaner script - removes EdgeWebView - most programs install it, if it's needed and not found - removes EdgeUpdate (the updater) * removed local copy of the RegionPolicy - and Preprocessing refactor * Omit Webview from Uninstall --------- Co-authored-by: Chris Titus <contact@christitus.com>
This commit is contained in:
parent
c619d02724
commit
138c5de5d3
@ -1 +0,0 @@
|
|||||||
"enabled": ["AT", "BE", "BG", "CH", "CY", "CZ", "DE", "DK", "EE", "ES", "FI", "FR", "GF", "GP", "GR", "HR", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MT", "MQ", "NL", "NO", "PL", "PT", "RE", "RO", "SE", "SI", "SK", "YT"]
|
|
@ -2556,14 +2556,14 @@
|
|||||||
},
|
},
|
||||||
"WPFTweaksRemoveEdge": {
|
"WPFTweaksRemoveEdge": {
|
||||||
"Content": "Remove Microsoft Edge",
|
"Content": "Remove Microsoft Edge",
|
||||||
"Description": "Removes MS Edge when it gets reinstalled by updates. Credit: Techie Jack",
|
"Description": "Removes MS Edge when it gets reinstalled by updates. Credit: Psyirius",
|
||||||
"category": "z__Advanced Tweaks - CAUTION",
|
"category": "z__Advanced Tweaks - CAUTION",
|
||||||
"panel": "1",
|
"panel": "1",
|
||||||
"Order": "a029_",
|
"Order": "a029_",
|
||||||
"InvokeScript": [
|
"InvokeScript": [
|
||||||
"
|
"
|
||||||
Uninstall-WinUtilEdgeBrowser
|
Uninstall-WinUtilEdgeBrowser
|
||||||
"
|
"
|
||||||
],
|
],
|
||||||
"UndoScript": [
|
"UndoScript": [
|
||||||
"
|
"
|
||||||
|
138
edgeremoval.ps1
138
edgeremoval.ps1
@ -1,138 +0,0 @@
|
|||||||
$msedgeProcess = Get-Process -Name "msedge" -ErrorAction SilentlyContinue
|
|
||||||
$widgetsProcess = Get-Process -Name "widgets" -ErrorAction SilentlyContinue
|
|
||||||
# Checking if Microsoft Edge is running
|
|
||||||
if ($msedgeProcess) {
|
|
||||||
Stop-Process -Name "msedge" -Force
|
|
||||||
} else {
|
|
||||||
Write-Output "msedge process is not running."
|
|
||||||
}
|
|
||||||
# Checking if Widgets is running
|
|
||||||
if ($widgetsProcess) {
|
|
||||||
Stop-Process -Name "widgets" -Force
|
|
||||||
} else {
|
|
||||||
Write-Output "widgets process is not running."
|
|
||||||
}
|
|
||||||
|
|
||||||
function Uninstall-Process {
|
|
||||||
param (
|
|
||||||
[Parameter(Mandatory = $true)]
|
|
||||||
[string]$Key
|
|
||||||
)
|
|
||||||
|
|
||||||
$originalNation = [microsoft.win32.registry]::GetValue('HKEY_USERS\.DEFAULT\Control Panel\International\Geo', 'Nation', [Microsoft.Win32.RegistryValueKind]::String)
|
|
||||||
|
|
||||||
# Set Nation to 84 (France) temporarily
|
|
||||||
[microsoft.win32.registry]::SetValue('HKEY_USERS\.DEFAULT\Control Panel\International\Geo', 'Nation', 68, [Microsoft.Win32.RegistryValueKind]::String) | Out-Null
|
|
||||||
|
|
||||||
# credits to he3als for the Acl commands
|
|
||||||
$fileName = "IntegratedServicesRegionPolicySet.json"
|
|
||||||
$pathISRPS = [Environment]::SystemDirectory + "\" + $fileName
|
|
||||||
$aclISRPS = Get-Acl -Path $pathISRPS
|
|
||||||
$aclISRPSBackup = [System.Security.AccessControl.FileSecurity]::new()
|
|
||||||
$aclISRPSBackup.SetSecurityDescriptorSddlForm($acl.Sddl)
|
|
||||||
if (Test-Path -Path $pathISRPS) {
|
|
||||||
try {
|
|
||||||
$admin = [System.Security.Principal.NTAccount]$(New-Object System.Security.Principal.SecurityIdentifier('S-1-5-32-544')).Translate([System.Security.Principal.NTAccount]).Value
|
|
||||||
|
|
||||||
$aclISRPS.SetOwner($admin)
|
|
||||||
$rule = New-Object System.Security.AccessControl.FileSystemAccessRule($admin, 'FullControl', 'Allow')
|
|
||||||
$aclISRPS.AddAccessRule($rule)
|
|
||||||
Set-Acl -Path $pathISRPS -AclObject $aclISRPS
|
|
||||||
|
|
||||||
Rename-Item -Path $pathISRPS -NewName ($fileName + '.bak') -Force
|
|
||||||
}
|
|
||||||
catch {
|
|
||||||
Write-Error "[$Mode] Failed to set owner for $pathISRPS"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$baseKey = 'HKLM:\SOFTWARE\WOW6432Node\Microsoft\EdgeUpdate'
|
|
||||||
$registryPath = $baseKey + '\ClientState\' + $Key
|
|
||||||
|
|
||||||
if (!(Test-Path -Path $registryPath)) {
|
|
||||||
Write-Host "[$Mode] Registry key not found: $registryPath"
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
Remove-ItemProperty -Path $registryPath -Name "experiment_control_labels" -ErrorAction SilentlyContinue | Out-Null
|
|
||||||
|
|
||||||
$uninstallString = (Get-ItemProperty -Path $registryPath).UninstallString
|
|
||||||
$uninstallArguments = (Get-ItemProperty -Path $registryPath).UninstallArguments
|
|
||||||
|
|
||||||
if ([string]::IsNullOrEmpty($uninstallString) -or [string]::IsNullOrEmpty($uninstallArguments)) {
|
|
||||||
Write-Host "[$Mode] Cannot find uninstall methods for $Mode"
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
$uninstallArguments += " --force-uninstall --delete-profile"
|
|
||||||
|
|
||||||
# $uninstallCommand = "`"$uninstallString`"" + $uninstallArguments
|
|
||||||
if (!(Test-Path -Path $uninstallString)) {
|
|
||||||
Write-Host "[$Mode] setup.exe not found at: $uninstallString"
|
|
||||||
return
|
|
||||||
}
|
|
||||||
Start-Process -FilePath $uninstallString -ArgumentList $uninstallArguments -Wait -NoNewWindow -Verbose
|
|
||||||
|
|
||||||
# Restore Acl
|
|
||||||
if (Test-Path -Path ($pathISRPS + '.bak')) {
|
|
||||||
Rename-Item -Path ($pathISRPS + '.bak') -NewName $fileName -Force
|
|
||||||
Set-Acl -Path $pathISRPS -AclObject $aclISRPSBackup
|
|
||||||
}
|
|
||||||
|
|
||||||
# Restore Nation
|
|
||||||
[microsoft.win32.registry]::SetValue('HKEY_USERS\.DEFAULT\Control Panel\International\Geo', 'Nation', $originalNation, [Microsoft.Win32.RegistryValueKind]::String) | Out-Null
|
|
||||||
|
|
||||||
if ((Get-ItemProperty -Path $baseKey).IsEdgeStableUninstalled -eq 1) {
|
|
||||||
Write-Host "[$Mode] Edge Stable has been successfully uninstalled"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function Uninstall-Edge {
|
|
||||||
Remove-ItemProperty -Path "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Microsoft Edge" -Name "NoRemove" -ErrorAction SilentlyContinue | Out-Null
|
|
||||||
|
|
||||||
[microsoft.win32.registry]::SetValue("HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\EdgeUpdateDev", "AllowUninstall", 1, [Microsoft.Win32.RegistryValueKind]::DWord) | Out-Null
|
|
||||||
|
|
||||||
Uninstall-Process -Key '{56EB18F8-B008-4CBD-B6D2-8C97FE7E9062}'
|
|
||||||
|
|
||||||
@( "$env:ProgramData\Microsoft\Windows\Start Menu\Programs",
|
|
||||||
"$env:PUBLIC\Desktop",
|
|
||||||
"$env:USERPROFILE\Desktop" ) | ForEach-Object {
|
|
||||||
$shortcutPath = Join-Path -Path $_ -ChildPath "Microsoft Edge.lnk"
|
|
||||||
if (Test-Path -Path $shortcutPath) {
|
|
||||||
Remove-Item -Path $shortcutPath -Force
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function Uninstall-WebView {
|
|
||||||
Remove-ItemProperty -Path "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Microsoft EdgeWebView" -Name "NoRemove" -ErrorAction SilentlyContinue | Out-Null
|
|
||||||
|
|
||||||
# Force to use system-wide WebView2
|
|
||||||
# [microsoft.win32.registry]::SetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Edge\WebView2\BrowserExecutableFolder", "*", "%%SystemRoot%%\System32\Microsoft-Edge-WebView")
|
|
||||||
|
|
||||||
Uninstall-Process -Key '{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}'
|
|
||||||
}
|
|
||||||
|
|
||||||
function Uninstall-EdgeUpdate {
|
|
||||||
Remove-ItemProperty -Path "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Microsoft Edge Update" -Name "NoRemove" -ErrorAction SilentlyContinue | Out-Null
|
|
||||||
|
|
||||||
$registryPath = 'HKLM:\SOFTWARE\WOW6432Node\Microsoft\EdgeUpdate'
|
|
||||||
if (!(Test-Path -Path $registryPath)) {
|
|
||||||
Write-Host "Registry key not found: $registryPath"
|
|
||||||
return
|
|
||||||
}
|
|
||||||
$uninstallCmdLine = (Get-ItemProperty -Path $registryPath).UninstallCmdLine
|
|
||||||
|
|
||||||
if ([string]::IsNullOrEmpty($uninstallCmdLine)) {
|
|
||||||
Write-Host "Cannot find uninstall methods for $Mode"
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
Write-Output "Uninstalling: $uninstallCmdLine"
|
|
||||||
Start-Process cmd.exe "/c $uninstallCmdLine" -WindowStyle Hidden -Wait
|
|
||||||
}
|
|
||||||
|
|
||||||
Uninstall-Edge
|
|
||||||
# "WebView" { Uninstall-WebView }
|
|
||||||
# "EdgeUpdate" { Uninstall-EdgeUpdate }
|
|
@ -1,152 +1,101 @@
|
|||||||
Function Uninstall-WinUtilEdgeBrowser {
|
Function Uninstall-WinUtilEdgeBrowser {
|
||||||
|
|
||||||
<#
|
<#
|
||||||
|
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
This will uninstall edge by changing the region to Ireland and uninstalling edge the changing it back
|
Uninstall the Edge Browser (Chromium) from the system in an elegant way.
|
||||||
|
.DESCRIPTION
|
||||||
|
This will switch up the region to one of the EEA countries temporarily and uninstall the Edge Browser (Chromium).
|
||||||
#>
|
#>
|
||||||
|
|
||||||
$msedgeProcess = Get-Process -Name "msedge" -ErrorAction SilentlyContinue
|
function Uninstall-EdgeClient {
|
||||||
$widgetsProcess = Get-Process -Name "widgets" -ErrorAction SilentlyContinue
|
param (
|
||||||
# Checking if Microsoft Edge is running
|
[Parameter(Mandatory = $true)]
|
||||||
if ($msedgeProcess) {
|
[string]$Key
|
||||||
Stop-Process -Name "msedge" -Force
|
)
|
||||||
} else {
|
|
||||||
Write-Output "msedge process is not running."
|
|
||||||
}
|
|
||||||
# Checking if Widgets is running
|
|
||||||
if ($widgetsProcess) {
|
|
||||||
Stop-Process -Name "widgets" -Force
|
|
||||||
} else {
|
|
||||||
Write-Output "widgets process is not running."
|
|
||||||
}
|
|
||||||
|
|
||||||
function Uninstall-Process {
|
$originalNation = [microsoft.win32.registry]::GetValue('HKEY_USERS\.DEFAULT\Control Panel\International\Geo', 'Nation', [Microsoft.Win32.RegistryValueKind]::String)
|
||||||
param (
|
|
||||||
[Parameter(Mandatory = $true)]
|
|
||||||
[string]$Key
|
|
||||||
)
|
|
||||||
|
|
||||||
$originalNation = [microsoft.win32.registry]::GetValue('HKEY_USERS\.DEFAULT\Control Panel\International\Geo', 'Nation', [Microsoft.Win32.RegistryValueKind]::String)
|
# Set Nation to any of the EEA regions temporarily
|
||||||
|
# Refer: https://learn.microsoft.com/en-us/windows/win32/intl/table-of-geographical-locations
|
||||||
|
$tmpNation = 68 # Ireland
|
||||||
|
[microsoft.win32.registry]::SetValue('HKEY_USERS\.DEFAULT\Control Panel\International\Geo', 'Nation', $tmpNation, [Microsoft.Win32.RegistryValueKind]::String) | Out-Null
|
||||||
|
|
||||||
# Set Nation to 84 (France) temporarily
|
$baseKey = 'HKLM:\SOFTWARE\WOW6432Node\Microsoft\EdgeUpdate'
|
||||||
[microsoft.win32.registry]::SetValue('HKEY_USERS\.DEFAULT\Control Panel\International\Geo', 'Nation', 68, [Microsoft.Win32.RegistryValueKind]::String) | Out-Null
|
$registryPath = $baseKey + '\ClientState\' + $Key
|
||||||
|
|
||||||
# credits to he3als for the Acl commands
|
if (!(Test-Path -Path $registryPath)) {
|
||||||
$fileName = "IntegratedServicesRegionPolicySet.json"
|
Write-Host "[$Mode] Registry key not found: $registryPath"
|
||||||
$pathISRPS = [Environment]::SystemDirectory + "\" + $fileName
|
return
|
||||||
$aclISRPS = Get-Acl -Path $pathISRPS
|
|
||||||
$aclISRPSBackup = [System.Security.AccessControl.FileSecurity]::new()
|
|
||||||
$aclISRPSBackup.SetSecurityDescriptorSddlForm($acl.Sddl)
|
|
||||||
if (Test-Path -Path $pathISRPS) {
|
|
||||||
try {
|
|
||||||
$admin = [System.Security.Principal.NTAccount]$(New-Object System.Security.Principal.SecurityIdentifier('S-1-5-32-544')).Translate([System.Security.Principal.NTAccount]).Value
|
|
||||||
|
|
||||||
$aclISRPS.SetOwner($admin)
|
|
||||||
$rule = New-Object System.Security.AccessControl.FileSystemAccessRule($admin, 'FullControl', 'Allow')
|
|
||||||
$aclISRPS.AddAccessRule($rule)
|
|
||||||
Set-Acl -Path $pathISRPS -AclObject $aclISRPS
|
|
||||||
|
|
||||||
Rename-Item -Path $pathISRPS -NewName ($fileName + '.bak') -Force
|
|
||||||
}
|
}
|
||||||
catch {
|
|
||||||
Write-Error "[$Mode] Failed to set owner for $pathISRPS"
|
# Remove the status flag
|
||||||
|
Remove-ItemProperty -Path $baseKey -Name "IsEdgeStableUninstalled" -ErrorAction SilentlyContinue | Out-Null
|
||||||
|
|
||||||
|
Remove-ItemProperty -Path $registryPath -Name "experiment_control_labels" -ErrorAction SilentlyContinue | Out-Null
|
||||||
|
|
||||||
|
$uninstallString = (Get-ItemProperty -Path $registryPath).UninstallString
|
||||||
|
$uninstallArguments = (Get-ItemProperty -Path $registryPath).UninstallArguments
|
||||||
|
|
||||||
|
if ([string]::IsNullOrEmpty($uninstallString) -or [string]::IsNullOrEmpty($uninstallArguments)) {
|
||||||
|
Write-Host "[$Mode] Cannot find uninstall methods for $Mode"
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
# Extra arguments to nuke it
|
||||||
|
$uninstallArguments += " --force-uninstall --delete-profile"
|
||||||
|
|
||||||
|
# $uninstallCommand = "`"$uninstallString`"" + $uninstallArguments
|
||||||
|
if (!(Test-Path -Path $uninstallString)) {
|
||||||
|
Write-Host "[$Mode] setup.exe not found at: $uninstallString"
|
||||||
|
return
|
||||||
|
}
|
||||||
|
Start-Process -FilePath $uninstallString -ArgumentList $uninstallArguments -Wait -NoNewWindow -Verbose
|
||||||
|
|
||||||
|
# Restore Nation back to the original
|
||||||
|
[microsoft.win32.registry]::SetValue('HKEY_USERS\.DEFAULT\Control Panel\International\Geo', 'Nation', $originalNation, [Microsoft.Win32.RegistryValueKind]::String) | Out-Null
|
||||||
|
|
||||||
|
# might not exist in some cases
|
||||||
|
if ((Get-ItemProperty -Path $baseKey).IsEdgeStableUninstalled -eq 1) {
|
||||||
|
Write-Host "[$Mode] Edge Stable has been successfully uninstalled"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$baseKey = 'HKLM:\SOFTWARE\WOW6432Node\Microsoft\EdgeUpdate'
|
function Uninstall-Edge {
|
||||||
$registryPath = $baseKey + '\ClientState\' + $Key
|
Remove-ItemProperty -Path "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Microsoft Edge" -Name "NoRemove" -ErrorAction SilentlyContinue | Out-Null
|
||||||
|
|
||||||
if (!(Test-Path -Path $registryPath)) {
|
[microsoft.win32.registry]::SetValue("HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\EdgeUpdateDev", "AllowUninstall", 1, [Microsoft.Win32.RegistryValueKind]::DWord) | Out-Null
|
||||||
Write-Host "[$Mode] Registry key not found: $registryPath"
|
|
||||||
return
|
Uninstall-EdgeClient -Key '{56EB18F8-B008-4CBD-B6D2-8C97FE7E9062}'
|
||||||
}
|
}
|
||||||
|
|
||||||
Remove-ItemProperty -Path $registryPath -Name "experiment_control_labels" -ErrorAction SilentlyContinue | Out-Null
|
function Uninstall-WebView {
|
||||||
|
# FIXME: might not work on some systems
|
||||||
|
|
||||||
$uninstallString = (Get-ItemProperty -Path $registryPath).UninstallString
|
Remove-ItemProperty -Path "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Microsoft EdgeWebView" -Name "NoRemove" -ErrorAction SilentlyContinue | Out-Null
|
||||||
$uninstallArguments = (Get-ItemProperty -Path $registryPath).UninstallArguments
|
|
||||||
|
|
||||||
if ([string]::IsNullOrEmpty($uninstallString) -or [string]::IsNullOrEmpty($uninstallArguments)) {
|
Uninstall-EdgeClient -Key '{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}'
|
||||||
Write-Host "[$Mode] Cannot find uninstall methods for $Mode"
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$uninstallArguments += " --force-uninstall --delete-profile"
|
function Uninstall-EdgeUpdate {
|
||||||
|
# FIXME: might not work on some systems
|
||||||
|
|
||||||
# $uninstallCommand = "`"$uninstallString`"" + $uninstallArguments
|
Remove-ItemProperty -Path "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Microsoft Edge Update" -Name "NoRemove" -ErrorAction SilentlyContinue | Out-Null
|
||||||
if (!(Test-Path -Path $uninstallString)) {
|
|
||||||
Write-Host "[$Mode] setup.exe not found at: $uninstallString"
|
|
||||||
return
|
|
||||||
}
|
|
||||||
Start-Process -FilePath $uninstallString -ArgumentList $uninstallArguments -Wait -NoNewWindow -Verbose
|
|
||||||
|
|
||||||
# Restore Acl
|
$registryPath = 'HKLM:\SOFTWARE\WOW6432Node\Microsoft\EdgeUpdate'
|
||||||
if (Test-Path -Path ($pathISRPS + '.bak')) {
|
if (!(Test-Path -Path $registryPath)) {
|
||||||
Rename-Item -Path ($pathISRPS + '.bak') -NewName $fileName -Force
|
Write-Host "Registry key not found: $registryPath"
|
||||||
Set-Acl -Path $pathISRPS -AclObject $aclISRPSBackup
|
return
|
||||||
}
|
|
||||||
|
|
||||||
# Restore Nation
|
|
||||||
[microsoft.win32.registry]::SetValue('HKEY_USERS\.DEFAULT\Control Panel\International\Geo', 'Nation', $originalNation, [Microsoft.Win32.RegistryValueKind]::String) | Out-Null
|
|
||||||
|
|
||||||
if ((Get-ItemProperty -Path $baseKey).IsEdgeStableUninstalled -eq 1) {
|
|
||||||
Write-Host "[$Mode] Edge Stable has been successfully uninstalled"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function Uninstall-Edge {
|
|
||||||
Remove-ItemProperty -Path "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Microsoft Edge" -Name "NoRemove" -ErrorAction SilentlyContinue | Out-Null
|
|
||||||
|
|
||||||
[microsoft.win32.registry]::SetValue("HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\EdgeUpdateDev", "AllowUninstall", 1, [Microsoft.Win32.RegistryValueKind]::DWord) | Out-Null
|
|
||||||
|
|
||||||
Uninstall-Process -Key '{56EB18F8-B008-4CBD-B6D2-8C97FE7E9062}'
|
|
||||||
|
|
||||||
@( "$env:ProgramData\Microsoft\Windows\Start Menu\Programs",
|
|
||||||
"$env:PUBLIC\Desktop",
|
|
||||||
"$env:USERPROFILE\Desktop" ) | ForEach-Object {
|
|
||||||
$shortcutPath = Join-Path -Path $_ -ChildPath "Microsoft Edge.lnk"
|
|
||||||
if (Test-Path -Path $shortcutPath) {
|
|
||||||
Remove-Item -Path $shortcutPath -Force
|
|
||||||
}
|
}
|
||||||
|
$uninstallCmdLine = (Get-ItemProperty -Path $registryPath).UninstallCmdLine
|
||||||
|
|
||||||
|
if ([string]::IsNullOrEmpty($uninstallCmdLine)) {
|
||||||
|
Write-Host "Cannot find uninstall methods for $Mode"
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
Start-Process cmd.exe "/c $uninstallCmdLine" -WindowStyle Hidden -Wait
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
Uninstall-Edge
|
||||||
|
# Uninstall-WebView - WebView is needed for Visual Studio and some MS Store Games like Forza
|
||||||
function Uninstall-WebView {
|
Uninstall-EdgeUpdate
|
||||||
Remove-ItemProperty -Path "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Microsoft EdgeWebView" -Name "NoRemove" -ErrorAction SilentlyContinue | Out-Null
|
|
||||||
|
|
||||||
# Force to use system-wide WebView2
|
|
||||||
# [microsoft.win32.registry]::SetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Edge\WebView2\BrowserExecutableFolder", "*", "%%SystemRoot%%\System32\Microsoft-Edge-WebView")
|
|
||||||
|
|
||||||
Uninstall-Process -Key '{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}'
|
|
||||||
}
|
|
||||||
|
|
||||||
function Uninstall-EdgeUpdate {
|
|
||||||
Remove-ItemProperty -Path "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Microsoft Edge Update" -Name "NoRemove" -ErrorAction SilentlyContinue | Out-Null
|
|
||||||
|
|
||||||
$registryPath = 'HKLM:\SOFTWARE\WOW6432Node\Microsoft\EdgeUpdate'
|
|
||||||
if (!(Test-Path -Path $registryPath)) {
|
|
||||||
Write-Host "Registry key not found: $registryPath"
|
|
||||||
return
|
|
||||||
}
|
|
||||||
$uninstallCmdLine = (Get-ItemProperty -Path $registryPath).UninstallCmdLine
|
|
||||||
|
|
||||||
if ([string]::IsNullOrEmpty($uninstallCmdLine)) {
|
|
||||||
Write-Host "Cannot find uninstall methods for $Mode"
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
Write-Output "Uninstalling: $uninstallCmdLine"
|
|
||||||
Start-Process cmd.exe "/c $uninstallCmdLine" -WindowStyle Hidden -Wait
|
|
||||||
}
|
|
||||||
|
|
||||||
Uninstall-Edge
|
|
||||||
# "WebView" { Uninstall-WebView }
|
|
||||||
# "EdgeUpdate" { Uninstall-EdgeUpdate }
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user