winutil/docs/dev/tweaks/z--Advanced-Tweaks---CAUTION/RemoveEdge.md

226 lines
7.6 KiB
Markdown
Raw Permalink Normal View History

[Docs 02] Auto dev-docs & more (#2481) * Compile Winutil * pre-Releases (#1) * Create pre-release.yaml * Update release.yaml * Update pre-release.yaml * Create release-drafter.yml * Update release-drafter.yml * Update pre-release.yaml * Update pre-release.yaml * Update pre-release.yaml * Update pre-release.yaml * Update pre-release.yaml * Update pre-release.yaml * Update pre-release.yaml * Update pre-release.yaml * Update pre-release.yaml * Update release-drafter.yml * Update pre-release.yaml * Update release-drafter.yml * Update pre-release.yaml * Update release-drafter.yml * Update release-drafter.yml * Update pre-release.yaml * Update pre-release.yaml * Update release-drafter.yml * Update release-drafter.yml * Update release.yaml * Update release-drafter.yml * Update release-drafter.yml * Update pre-release.yaml * Compile Winutil * fixed end task with right click * Compile Winutil * code generator & compile integration * Compile Winutil * finish - add autogenerated table of content page named "Dev Docs", with table of content to all .md files - added invokescript & undoscript - generate documentation files * oops, remove dublicates * undo winutil.ps1 * remove prefixes WPF WinUtil Toggle $category Features Tweaks Panel Fixes * fixes - fix inconsistency in Featurenaming - add "Enable" & "Disable" as prefix to remove * fix spellin mistake * remove unneccesary whitespaces update info remove unnecessary whitespaces by only adding stuff to the md if it actually exists * rewrite prefix removal into one line definition * added taskscheduler support * add support for function calling add support for functioncalling - replace code formatting for invoke & undo script from json to powershell * content instead of displayname * add last modified date * contributing + docs generator - moved contribute.md to root CONTRIBUTING.md - referenced CONTRIBUTING.md in contribute.md - added toggle & button reference to functions - added function references in functions - changed mkdocs site styling * Use HashSet for processedFunctions Use HashSet for processedFunctions: - Ensures dynamic addition of functions without duplication. Recursive Function Scanning: - Includes all nested functions called by InvokeScript, UndoScript, ToggleScript, and ButtonScript. * follow github standards - add code of conduct - reference code of conduct in docs - regrouped docs navigation - add comment about the sourced md file * small fixes * change color from teal to blue in light mode * add links to tweaks * add archiving feature to autodocs * administrative - add script to releases and remove from compile - move link from after description to after category * small fixes - add S in feature.json - fix dating - move link to after category * fix links * undo link bc of bugs * add progress bar to script - add progress like in compile - moved archive folder creation to the beginning of the script * Simple improvements to 'auto-devdocs' branch (#3) * Fix links for tweaks & features * Make New Line characters work for Json Snippet * Change NewLine Character from Unix Style (LF) to Windows/DOS Style (CRLF) * rerun script * und workflows & rearrange navigation items * layer out itemname cutout * rework links & temp removal of archivation * fix adding link in json root not adding link member to root in json files * fix json generation replace '\r\n',"`r`n" with ('\n',"`n") * add features to auto md docs * add minify plugin * regex hotfix * refractor * add changelog to about section add link to changelog in docs for about section * undo changelog * Cleanup 'devdocs-generator.ps1' - Implement Zig Multiline String Feature (#4) * Cleanup 'devdocs-generator.ps1' - Implement Zig Multiline String Feature * Fix NewLine character replace in 'devdocs-generator.ps1' * run script * run script * Fix 'itemnametocut' RegEx in 'devdocs-generator.ps1' (#5) * rerun script * rework nav + remove code of conduct * undo workflow changes * run script * remove changelog --------- Co-authored-by: MyDrift-user <MyDrift-user@users.noreply.github.com> Co-authored-by: Mr.k <mineshtine28546271@gmail.com>
2024-08-07 10:55:23 -05:00
# Remove Microsoft Edge
Last Updated: 2024-08-07
!!! info
The Development Documentation is auto generated for every compilation of WinUtil, meaning a part of it will always stay up-to-date. **Developers do have the ability to add custom content, which won't be updated automatically.**
## Description
Removes MS Edge when it gets reinstalled by updates. Credit: Techie Jack
<!-- BEGIN CUSTOM CONTENT -->
<!-- END CUSTOM CONTENT -->
<details>
<summary>Preview Code</summary>
```json
{
"Content": "Remove Microsoft Edge",
"Description": "Removes MS Edge when it gets reinstalled by updates. Credit: Techie Jack",
"category": "z__Advanced Tweaks - CAUTION",
"panel": "1",
"Order": "a029_",
"InvokeScript": [
"
Uninstall-WinUtilEdgeBrowser
"
],
"UndoScript": [
"
Write-Host \"Install Microsoft Edge\"
Start-Process -FilePath winget -ArgumentList \"install --force -e --accept-source-agreements --accept-package-agreements --silent Microsoft.Edge \" -NoNewWindow -Wait
"
],
"link": "https://christitustech.github.io/winutil/dev/tweaks/z--Advanced-Tweaks---CAUTION/RemoveEdge"
}
```
</details>
## Invoke Script
```powershell
Uninstall-WinUtilEdgeBrowser
2024-08-07 11:57:14 -05:00
[Docs 02] Auto dev-docs & more (#2481) * Compile Winutil * pre-Releases (#1) * Create pre-release.yaml * Update release.yaml * Update pre-release.yaml * Create release-drafter.yml * Update release-drafter.yml * Update pre-release.yaml * Update pre-release.yaml * Update pre-release.yaml * Update pre-release.yaml * Update pre-release.yaml * Update pre-release.yaml * Update pre-release.yaml * Update pre-release.yaml * Update pre-release.yaml * Update release-drafter.yml * Update pre-release.yaml * Update release-drafter.yml * Update pre-release.yaml * Update release-drafter.yml * Update release-drafter.yml * Update pre-release.yaml * Update pre-release.yaml * Update release-drafter.yml * Update release-drafter.yml * Update release.yaml * Update release-drafter.yml * Update release-drafter.yml * Update pre-release.yaml * Compile Winutil * fixed end task with right click * Compile Winutil * code generator & compile integration * Compile Winutil * finish - add autogenerated table of content page named "Dev Docs", with table of content to all .md files - added invokescript & undoscript - generate documentation files * oops, remove dublicates * undo winutil.ps1 * remove prefixes WPF WinUtil Toggle $category Features Tweaks Panel Fixes * fixes - fix inconsistency in Featurenaming - add "Enable" & "Disable" as prefix to remove * fix spellin mistake * remove unneccesary whitespaces update info remove unnecessary whitespaces by only adding stuff to the md if it actually exists * rewrite prefix removal into one line definition * added taskscheduler support * add support for function calling add support for functioncalling - replace code formatting for invoke & undo script from json to powershell * content instead of displayname * add last modified date * contributing + docs generator - moved contribute.md to root CONTRIBUTING.md - referenced CONTRIBUTING.md in contribute.md - added toggle & button reference to functions - added function references in functions - changed mkdocs site styling * Use HashSet for processedFunctions Use HashSet for processedFunctions: - Ensures dynamic addition of functions without duplication. Recursive Function Scanning: - Includes all nested functions called by InvokeScript, UndoScript, ToggleScript, and ButtonScript. * follow github standards - add code of conduct - reference code of conduct in docs - regrouped docs navigation - add comment about the sourced md file * small fixes * change color from teal to blue in light mode * add links to tweaks * add archiving feature to autodocs * administrative - add script to releases and remove from compile - move link from after description to after category * small fixes - add S in feature.json - fix dating - move link to after category * fix links * undo link bc of bugs * add progress bar to script - add progress like in compile - moved archive folder creation to the beginning of the script * Simple improvements to 'auto-devdocs' branch (#3) * Fix links for tweaks & features * Make New Line characters work for Json Snippet * Change NewLine Character from Unix Style (LF) to Windows/DOS Style (CRLF) * rerun script * und workflows & rearrange navigation items * layer out itemname cutout * rework links & temp removal of archivation * fix adding link in json root not adding link member to root in json files * fix json generation replace '\r\n',"`r`n" with ('\n',"`n") * add features to auto md docs * add minify plugin * regex hotfix * refractor * add changelog to about section add link to changelog in docs for about section * undo changelog * Cleanup 'devdocs-generator.ps1' - Implement Zig Multiline String Feature (#4) * Cleanup 'devdocs-generator.ps1' - Implement Zig Multiline String Feature * Fix NewLine character replace in 'devdocs-generator.ps1' * run script * run script * Fix 'itemnametocut' RegEx in 'devdocs-generator.ps1' (#5) * rerun script * rework nav + remove code of conduct * undo workflow changes * run script * remove changelog --------- Co-authored-by: MyDrift-user <MyDrift-user@users.noreply.github.com> Co-authored-by: Mr.k <mineshtine28546271@gmail.com>
2024-08-07 10:55:23 -05:00
```
## Undo Script
```powershell
Write-Host "Install Microsoft Edge"
Start-Process -FilePath winget -ArgumentList "install --force -e --accept-source-agreements --accept-package-agreements --silent Microsoft.Edge " -NoNewWindow -Wait
2024-08-07 11:57:14 -05:00
[Docs 02] Auto dev-docs & more (#2481) * Compile Winutil * pre-Releases (#1) * Create pre-release.yaml * Update release.yaml * Update pre-release.yaml * Create release-drafter.yml * Update release-drafter.yml * Update pre-release.yaml * Update pre-release.yaml * Update pre-release.yaml * Update pre-release.yaml * Update pre-release.yaml * Update pre-release.yaml * Update pre-release.yaml * Update pre-release.yaml * Update pre-release.yaml * Update release-drafter.yml * Update pre-release.yaml * Update release-drafter.yml * Update pre-release.yaml * Update release-drafter.yml * Update release-drafter.yml * Update pre-release.yaml * Update pre-release.yaml * Update release-drafter.yml * Update release-drafter.yml * Update release.yaml * Update release-drafter.yml * Update release-drafter.yml * Update pre-release.yaml * Compile Winutil * fixed end task with right click * Compile Winutil * code generator & compile integration * Compile Winutil * finish - add autogenerated table of content page named "Dev Docs", with table of content to all .md files - added invokescript & undoscript - generate documentation files * oops, remove dublicates * undo winutil.ps1 * remove prefixes WPF WinUtil Toggle $category Features Tweaks Panel Fixes * fixes - fix inconsistency in Featurenaming - add "Enable" & "Disable" as prefix to remove * fix spellin mistake * remove unneccesary whitespaces update info remove unnecessary whitespaces by only adding stuff to the md if it actually exists * rewrite prefix removal into one line definition * added taskscheduler support * add support for function calling add support for functioncalling - replace code formatting for invoke & undo script from json to powershell * content instead of displayname * add last modified date * contributing + docs generator - moved contribute.md to root CONTRIBUTING.md - referenced CONTRIBUTING.md in contribute.md - added toggle & button reference to functions - added function references in functions - changed mkdocs site styling * Use HashSet for processedFunctions Use HashSet for processedFunctions: - Ensures dynamic addition of functions without duplication. Recursive Function Scanning: - Includes all nested functions called by InvokeScript, UndoScript, ToggleScript, and ButtonScript. * follow github standards - add code of conduct - reference code of conduct in docs - regrouped docs navigation - add comment about the sourced md file * small fixes * change color from teal to blue in light mode * add links to tweaks * add archiving feature to autodocs * administrative - add script to releases and remove from compile - move link from after description to after category * small fixes - add S in feature.json - fix dating - move link to after category * fix links * undo link bc of bugs * add progress bar to script - add progress like in compile - moved archive folder creation to the beginning of the script * Simple improvements to 'auto-devdocs' branch (#3) * Fix links for tweaks & features * Make New Line characters work for Json Snippet * Change NewLine Character from Unix Style (LF) to Windows/DOS Style (CRLF) * rerun script * und workflows & rearrange navigation items * layer out itemname cutout * rework links & temp removal of archivation * fix adding link in json root not adding link member to root in json files * fix json generation replace '\r\n',"`r`n" with ('\n',"`n") * add features to auto md docs * add minify plugin * regex hotfix * refractor * add changelog to about section add link to changelog in docs for about section * undo changelog * Cleanup 'devdocs-generator.ps1' - Implement Zig Multiline String Feature (#4) * Cleanup 'devdocs-generator.ps1' - Implement Zig Multiline String Feature * Fix NewLine character replace in 'devdocs-generator.ps1' * run script * run script * Fix 'itemnametocut' RegEx in 'devdocs-generator.ps1' (#5) * rerun script * rework nav + remove code of conduct * undo workflow changes * run script * remove changelog --------- Co-authored-by: MyDrift-user <MyDrift-user@users.noreply.github.com> Co-authored-by: Mr.k <mineshtine28546271@gmail.com>
2024-08-07 10:55:23 -05:00
```
## Function: Uninstall-WinUtilEdgeBrowser
```powershell
Function Uninstall-WinUtilEdgeBrowser {
<#
.SYNOPSIS
This will uninstall edge by changing the region to Ireland and uninstalling edge the changing it back
#>
$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 }
}
```
<!-- BEGIN SECOND CUSTOM CONTENT -->
<!-- END SECOND CUSTOM CONTENT -->
[View the JSON file](https://github.com/ChrisTitusTech/winutil/tree/main/config/tweaks.json)