From 793efc9d62f635814ca890f99895cf2d05337999 Mon Sep 17 00:00:00 2001 From: Chris Titus Date: Sat, 3 Feb 2024 15:48:52 -0600 Subject: [PATCH] cleanup winget --- functions/private/Install-WinUtilWinget.ps1 | 4 ++-- winutil.ps1 | 17 ++--------------- 2 files changed, 4 insertions(+), 17 deletions(-) diff --git a/functions/private/Install-WinUtilWinget.ps1 b/functions/private/Install-WinUtilWinget.ps1 index 9214cc0c6c..9407ca1131 100644 --- a/functions/private/Install-WinUtilWinget.ps1 +++ b/functions/private/Install-WinUtilWinget.ps1 @@ -22,7 +22,7 @@ function Install-WinUtilWinget { if (Test-WinUtilPackageManager -winget) { # Checks if winget executable exists and if the Windows Version is 1809 or higher Write-Host "Winget Already Installed" - Start-Process -Verb runas -FilePath powershell.exe -ArgumentList "winget settings --enable InstallerHashOverride" -Wait + Start-Process -Verb runas -FilePath powershell.exe -ArgumentList "winget settings --enable InstallerHashOverride" -Wait -NoNewWindow return } @@ -73,7 +73,7 @@ function Install-WinUtilWinget { # Third Method Write-Host "- Attempting third install method..." - Start-Process -Verb runas -FilePath powershell.exe -ArgumentList "choco install winget --force" -Wait + Start-Process -Verb runas -FilePath powershell.exe -ArgumentList "choco install winget --force" -Wait -NoNewWindow if (Test-WinUtilPackageManager -winget) { # Checks if winget executable exists and if the Windows Version is 1809 or higher Write-Host "Winget Installed via Chocolatey" diff --git a/winutil.ps1 b/winutil.ps1 index ba940d5060..d108075e13 100644 --- a/winutil.ps1 +++ b/winutil.ps1 @@ -612,20 +612,7 @@ function Install-WinUtilWinget { if (Test-WinUtilPackageManager -winget) { # Checks if winget executable exists and if the Windows Version is 1809 or higher Write-Host "Winget Already Installed" - # Define the path to the Winget settings file - $wingetSettingsPath = "$env:LOCALAPPDATA\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\settings.json" - - # Read the current settings from the file - $settings = Get-Content -Path $wingetSettingsPath | ConvertFrom-Json - - # Check if InstallerHashOverride is already enabled - if ($settings.PSObject.Properties.Name -notcontains 'InstallerHashOverride' -or $settings.InstallerHashOverride -ne "Enabled") { - # If not present or not enabled, set it to Enabled - Start-Process -Verb runas -FilePath powershell.exe -ArgumentList "winget settings --enable InstallerHashOverride" - Write-Host "InstallerHashOverride has been enabled for Winget." - } else { - Write-Host "InstallerHashOverride is already enabled for Winget." - } + Start-Process -Verb runas -FilePath powershell.exe -ArgumentList "winget settings --enable InstallerHashOverride" -Wait -NoNewWindow return } @@ -676,7 +663,7 @@ function Install-WinUtilWinget { # Third Method Write-Host "- Attempting third install method..." - Start-Process -Verb runas -FilePath powershell.exe -ArgumentList "choco install winget --force" + Start-Process -Verb runas -FilePath powershell.exe -ArgumentList "choco install winget --force" -Wait -NoNewWindow if (Test-WinUtilPackageManager -winget) { # Checks if winget executable exists and if the Windows Version is 1809 or higher Write-Host "Winget Installed via Chocolatey"