mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2025-06-28 09:04:47 -05:00
Edge Removal Fix
This commit is contained in:
@ -4,7 +4,7 @@ Function Invoke-WinUtilDetailedBSoD {
|
||||
.SYNOPSIS
|
||||
Enables/Disables Detailed BSoD
|
||||
(Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\CrashControl' -Name 'DisplayParameters').DisplayParameters
|
||||
|
||||
|
||||
|
||||
#>
|
||||
Param($Enabled)
|
||||
|
@ -16,7 +16,7 @@ Function Invoke-WinUtilWingetProgram {
|
||||
|
||||
param(
|
||||
[Parameter(Mandatory, Position=0)]$Programs,
|
||||
|
||||
|
||||
[Parameter(Mandatory, Position=1)]
|
||||
[ValidateSet("Install", "Uninstall")]
|
||||
[String]$Action
|
||||
@ -35,7 +35,7 @@ Function Invoke-WinUtilWingetProgram {
|
||||
|
||||
.PARAMETER credential
|
||||
The PSCredential Object of the user that should be used to run winget
|
||||
|
||||
|
||||
.NOTES
|
||||
Invoke Winget uses the public variable $Action defined outside the function to determine if a Program should be installed or removed
|
||||
#>
|
||||
@ -47,7 +47,7 @@ Function Invoke-WinUtilWingetProgram {
|
||||
|
||||
$commonArguments = "--id $wingetId --silent"
|
||||
$arguments = if ($Action -eq "Install") {
|
||||
"install $commonArguments --accept-source-agreements --accept-package-agreements $(if ($scope) {" --scope $scope"})"
|
||||
"install $commonArguments --accept-source-agreements --accept-package-agreements $(if ($scope) {" --scope $scope"})"
|
||||
} else {
|
||||
"uninstall $commonArguments"
|
||||
}
|
||||
@ -63,15 +63,15 @@ Function Invoke-WinUtilWingetProgram {
|
||||
if ($credential) {
|
||||
$processParams.credential = $credential
|
||||
}
|
||||
|
||||
return (Start-Process @processParams).ExitCode
|
||||
|
||||
return (Start-Process @processParams).ExitCode
|
||||
}
|
||||
|
||||
Function Invoke-Install {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Contains the Install Logic and return code handling from winget
|
||||
|
||||
|
||||
.PARAMETER Program
|
||||
The Winget ID of the Program that should be installed
|
||||
#>
|
||||
@ -117,14 +117,14 @@ Function Invoke-WinUtilWingetProgram {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Contains the Uninstall Logic and return code handling from winget
|
||||
|
||||
|
||||
.PARAMETER Program
|
||||
The Winget ID of the Program that should be uninstalled
|
||||
#>
|
||||
param (
|
||||
[psobject]$Program
|
||||
)
|
||||
|
||||
|
||||
try {
|
||||
$status = Invoke-Winget -wingetId $Program
|
||||
if ($status -eq 0) {
|
||||
@ -142,21 +142,21 @@ Function Invoke-WinUtilWingetProgram {
|
||||
|
||||
$count = $Programs.Count
|
||||
$failedPackages = @()
|
||||
|
||||
|
||||
Write-Host "==========================================="
|
||||
Write-Host "-- Configuring winget packages ---"
|
||||
Write-Host "==========================================="
|
||||
|
||||
|
||||
for ($i = 0; $i -lt $count; $i++) {
|
||||
$Program = $Programs[$i]
|
||||
$result = $false
|
||||
Set-WinUtilProgressBar -label "$Action $($Program)" -percent ($i / $count * 100)
|
||||
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -value ($i / $count)})
|
||||
|
||||
|
||||
$result = switch ($Action) {
|
||||
"Install" {Invoke-Install -Program $Program}
|
||||
"Uninstall" {Invoke-Uninstall -Program $Program}
|
||||
default {throw "[Install-WinUtilProgramWinget] Invalid action: $Action"}
|
||||
default {throw "[Install-WinUtilProgramWinget] Invalid action: $Action"}
|
||||
}
|
||||
|
||||
if (-not $result) {
|
||||
|
@ -1,12 +1,12 @@
|
||||
function Set-WinUtilProgressbar{
|
||||
<#
|
||||
.SYNOPSIS
|
||||
This function is used to Update the Progress Bar displayed in the winutil GUI.
|
||||
It will be automatically hidden if the user clicks something and no process is running
|
||||
This function is used to Update the Progress Bar displayed in the winutil GUI.
|
||||
It will be automatically hidden if the user clicks something and no process is running
|
||||
.PARAMETER Label
|
||||
The Text to be overlayed onto the Progress Bar
|
||||
.PARAMETER PERCENT
|
||||
The percentage of the Progress Bar that should be filled (0-100)
|
||||
The percentage of the Progress Bar that should be filled (0-100)
|
||||
.PARAMETER Hide
|
||||
If provided, the Progress Bar and the label will be hidden
|
||||
#>
|
||||
@ -17,14 +17,14 @@ function Set-WinUtilProgressbar{
|
||||
$Hide
|
||||
)
|
||||
if ($hide) {
|
||||
$sync.form.Dispatcher.Invoke([action]{$sync.ProgressBarLabel.Visibility = "Collapsed"})
|
||||
$sync.form.Dispatcher.Invoke([action]{$sync.ProgressBar.Visibility = "Collapsed"})
|
||||
$sync.form.Dispatcher.Invoke([action]{$sync.ProgressBarLabel.Visibility = "Collapsed"})
|
||||
$sync.form.Dispatcher.Invoke([action]{$sync.ProgressBar.Visibility = "Collapsed"})
|
||||
} else {
|
||||
$sync.form.Dispatcher.Invoke([action]{$sync.ProgressBarLabel.Visibility = "Visible"})
|
||||
$sync.form.Dispatcher.Invoke([action]{$sync.ProgressBar.Visibility = "Visible"})
|
||||
$sync.form.Dispatcher.Invoke([action]{$sync.ProgressBarLabel.Visibility = "Visible"})
|
||||
$sync.form.Dispatcher.Invoke([action]{$sync.ProgressBar.Visibility = "Visible"})
|
||||
}
|
||||
$sync.form.Dispatcher.Invoke([action]{$sync.ProgressBarLabel.Content.Text = $label})
|
||||
$sync.form.Dispatcher.Invoke([action]{$sync.ProgressBarLabel.Content.ToolTip = $label})
|
||||
$sync.form.Dispatcher.Invoke([action]{$sync.ProgressBarLabel.Content.Text = $label})
|
||||
$sync.form.Dispatcher.Invoke([action]{$sync.ProgressBarLabel.Content.ToolTip = $label})
|
||||
$sync.form.Dispatcher.Invoke([action]{ $sync.ProgressBar.Value = $percent})
|
||||
|
||||
|
||||
}
|
||||
|
@ -221,7 +221,7 @@ $cttLogoPath = @"
|
||||
$hyperlink.Inlines.Add($match.Groups[2].Value)
|
||||
$hyperlink.TextDecorations = [Windows.TextDecorations]::None # Remove underline
|
||||
$hyperlink.Foreground = $sync.configs.themes.$ctttheme.LinkForegroundColor
|
||||
|
||||
|
||||
$hyperlink.Add_Click({
|
||||
param($sender, $args)
|
||||
Start-Process $sender.NavigateUri.AbsoluteUri
|
||||
|
@ -32,7 +32,7 @@ function Uninstall-Process {
|
||||
|
||||
# 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
|
||||
@ -42,19 +42,19 @@ function Uninstall-Process {
|
||||
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
|
||||
|
||||
@ -93,16 +93,16 @@ function Uninstall-Process {
|
||||
|
||||
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 {
|
||||
@ -117,7 +117,7 @@ function Uninstall-Edge {
|
||||
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
|
||||
# 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}'
|
||||
@ -149,4 +149,4 @@ Uninstall-Edge
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user