Files
winutil/functions/private/Install-WinUtilWinget.ps1
Gabi 1b78cd1316 Update-Install-WinUtilWinget.ps1 and remove upgrading winget (#3839)
* Update Install-WinUtilWinget.ps1

* Update Install-WinUtilWinget.ps1

* Update Install-WinUtilWinget.ps1

* Update Install-WinUtilWinget.ps1

* Update Install-WinUtilWinget.ps1

* Update Install-WinUtilWinget.ps1

* Update Install-WinUtilWinget.ps1

* Update Test-WinUtilPackageManager.ps1

* Update Install-WinUtilWinget.ps1

* Update Install-WinUtilWinget.ps1

* Update Install-WinUtilWinget.ps1

* Change error action to SilentlyContinue for commands

* Fix indentation in Test-WinUtilPackageManager.ps1

---------

Co-authored-by: Gabi <218829269+Gabynun@users.noreply.github.com>
Co-authored-by: Chris Titus <contact@christitus.com>
2026-01-05 16:16:19 -06:00

22 lines
564 B
PowerShell

function Install-WinUtilWinget {
<#
.SYNOPSIS
Installs Winget if not already installed.
.DESCRIPTION
installs winget if needed
#>
if ((Test-WinUtilPackageManager -winget) -eq "installed") {
return
}
Write-Host "Winget is not Installed. Installing." -ForegroundColor Red
Set-PSRepository -Name PSGallery -InstallationPolicy Trusted
Install-PackageProvider -Name NuGet -Force
Install-Module Microsoft.WinGet.Client -Force
Import-Module Microsoft.WinGet.Client
Repair-WinGetPackageManager
}