Skip to content

Commit

Permalink
Improvements to WinGet Installation script
Browse files Browse the repository at this point in the history
  • Loading branch information
marticliment committed Jul 2, 2024
1 parent 65945fd commit 3b9b1e4
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions InstallerExtras/EnsureWinGet.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ if (!(Get-Command -Verb Repair -Noun WinGetPackageManager)) {
try
{
Write-Output "Attempting to uninstall an older version of Microsoft.WinGet.Client..."
Uninstall-Module -Name Microsoft.WinGet.Client -Confirm:$false -Force
Uninstall-Module -Name Microsoft.WinGet.Client -Confirm:$false -Force -Scope CurrentUser
}
catch
{
Write-Output "Microsoft.WinGet.Client was not installed."
}
Write-Output "Installing Microsoft.WinGet.Client..."
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force -Confirm:$false
Install-Module -Name Microsoft.WinGet.Client -Confirm:$false -Force
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force -Confirm:$false -Scope CurrentUser
Install-Module -Name Microsoft.WinGet.Client -Confirm:$false -Force -Scope CurrentUser
Write-Output "Microsoft.WinGet.Client was installed successfully"
}

Expand All @@ -22,8 +22,7 @@ if ((Get-Module -Name Microsoft.WinGet.Client -ListAvailable).Version -ge '1.8.1
Write-Output "Microsoft.WinGet.Client is up-to-date"
} else {
Write-Output "Updating Microsoft.WinGet.Client module..."
Update-Module -Name Microsoft.WinGet.Client -Confirm:$false -Force
Install-Module -Name Microsoft.WinGet.Client -Confirm:$false -Force
Update-Module -Name Microsoft.WinGet.Client -Confirm:$false -Force -Scope CurrentUser
}

if ($null -eq (Get-Command "winget.exe" -ErrorAction SilentlyContinue))
Expand Down

0 comments on commit 3b9b1e4

Please sign in to comment.