getwinget - gwg.aly.pet
Use the below snippet in Powershell as Administrator to ensure that winget is installed. (Use tab to select the copy button you want, then press spacebar)
irm https://gwg.aly.pet | iex
I recommend installing scoop and sudo.ps1 first:
irm https://get.scoop.sh | iex
scoop install git sudo # scoop requires git to be installed
sudo powershell
irm https://gwg.aly.pet | iex
exit
Here's the script source (which PowerShell runs directly from this HTML page, isn't that neat)
# #>
# The following PowerShell code verifies that WinGet is installed. Check https://gwg.aly.pet for more info
# irm gwg.aly.pet | iex
$adm = 'S-1-5-32-544'
$cur = [Security.Principal.WindowsIdentity]::GetCurrent()
if (-NOT ([bool]($cur.Groups -match $adm))) {
if ($cur.UserClaims | ? { $_.Value -eq $adm}) {
Write-Warning "Run Powershell as Administrator, or elevate with 'sudo pwsh' (https://github.com/lukesampson/psutils) and then run this command again"
return
} else {
Write-Error "Run Powershell as Administrator"
return
}
}
Install-PackageProvider -Name NuGet -Force -ErrorAction SilentlyContinue | Out-Null
Install-Module -Name Microsoft.WinGet.Client -Force -Repository PSGallery | Out-Null
Repair-WinGetPackageManager
if(!(get-command Add-AppxPackage)) {
Import-Module Appx -UseWinPS # fixes Get-AppxPackage being removed from pwsh 7
}
Add-AppxPackage https://cdn.winget.microsoft.com/cache/source.msix
winget source remove msstore <#
Check GitHub for more information: github.com/alyssadev/getwinget