Skip to content

Commit

Permalink
fix winget issues
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisTitusTech committed Feb 3, 2024
1 parent 23bade5 commit 7df98c2
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,4 @@ Microsoft.PowerShell.ConsoleHost.dll
.DS_Store
microwin.log
True
test.ps1
2 changes: 1 addition & 1 deletion functions/private/Install-WinUtilProgramWinget.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Function Install-WinUtilProgramWinget {

Write-Progress -Activity "$manage Applications" -Status "$manage $Program $($x + 1) of $count" -PercentComplete $($x/$count*100)
if($manage -eq "Installing"){
Start-Process -FilePath winget -ArgumentList "install -e --accept-source-agreements --accept-package-agreements --scope=machine --silent $Program" -NoNewWindow -Wait
Start-Process -FilePath winget -ArgumentList "install -e --accept-source-agreements --accept-package-agreements --ignore-security-hash --disable-interactivity --silent $Program" -NoNewWindow -Wait
}
if($manage -eq "Uninstalling"){
Start-Process -FilePath winget -ArgumentList "uninstall -e --purge --force --silent $Program" -NoNewWindow -Wait
Expand Down
3 changes: 2 additions & 1 deletion functions/private/Install-WinUtilWinget.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +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
return
}

Expand Down Expand Up @@ -72,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"
Start-Process -Verb runas -FilePath powershell.exe -ArgumentList "choco install winget --force" -Wait
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
18 changes: 16 additions & 2 deletions winutil.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,7 @@ Function Install-WinUtilProgramWinget {

Write-Progress -Activity "$manage Applications" -Status "$manage $Program $($x + 1) of $count" -PercentComplete $($x/$count*100)
if($manage -eq "Installing"){
Start-Process -FilePath winget -ArgumentList "install -e --accept-source-agreements --accept-package-agreements --scope=machine --silent $Program" -NoNewWindow -Wait
Start-Process -FilePath winget -ArgumentList "install -e --accept-source-agreements --accept-package-agreements --ignore-security-hash --disable-interactivity --silent $Program" -NoNewWindow -Wait
}
if($manage -eq "Uninstalling"){
Start-Process -FilePath winget -ArgumentList "uninstall -e --purge --force --silent $Program" -NoNewWindow -Wait
Expand Down Expand Up @@ -612,6 +612,20 @@ 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."
}
return
}

Expand Down Expand Up @@ -7730,7 +7744,7 @@ $sync.configs.applications = '{
"WPFInstallintelpresentmon": {
"category": "Utilities",
"choco": "na",
"content": "Intel?? PresentMon",
"content": "Intel? PresentMon",
"description": "A new gaming performance overlay and telemetry application to monitor and measure your gaming experience.",
"link": "https://game.intel.com/us/stories/intel-presentmon/",
"winget": "Intel.PresentMon.Beta"
Expand Down

0 comments on commit 7df98c2

Please sign in to comment.