Skip to content

Commit

Permalink
cleanup winget
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisTitusTech committed Feb 3, 2024
1 parent 7df98c2 commit 793efc9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 17 deletions.
4 changes: 2 additions & 2 deletions functions/private/Install-WinUtilWinget.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -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"
Expand Down
17 changes: 2 additions & 15 deletions winutil.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit 793efc9

Please sign in to comment.