Created
August 5, 2022 12:39
-
-
Save cdhunt/4425d986d4011b8fe6b749abdb5754af to your computer and use it in GitHub Desktop.
This will grab the WinGet appx file and two dependencies and install without user interaction.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Install-WinGet() { | |
Write-Information "[winget] Downloading Appx packages" | |
Push-Location $env:TEMP | |
# https://github.com/microsoft/winget-cli/issues/2230 | |
if (-not (Test-Path 'Microsoft.DesktopAppInstaller.msixbundle')) { | |
Write-Information "`tMicrosoft.DesktopAppInstaller" | |
Invoke-WebRequest 'https://aka.ms/getwinget' -OutFile 'Microsoft.DesktopAppInstaller.msixbundle' -UseBasicParsing | |
} | |
if (-not (Test-Path 'Microsoft.UI.Xaml.zip')) { | |
Write-Information "`tMicrosoft.UI.Xaml" | |
Invoke-WebRequest 'https://www.nuget.org/api/v2/package/Microsoft.UI.Xaml/2.7.1' -OutFile 'Microsoft.UI.Xaml.zip' -UseBasicParsing | |
} | |
if (-not (Test-Path 'Microsoft.VCLibs.x64.14.Desktop.appx')) { | |
Write-Information "`tMicrosoft.VCLibs.x64.14" | |
Invoke-WebRequest 'https://aka.ms/Microsoft.VCLibs.x64.14.00.Desktop.appx' -OutFile 'Microsoft.VCLibs.x64.14.Desktop.appx' -UseBasicParsing | |
} | |
if (-not (Test-Path '.\Microsoft.UI.Xaml\tools\AppX\x64\Release\Microsoft.UI.Xaml.2.7.appx')) { Expand-Archive 'Microsoft.UI.Xaml.zip' } | |
Write-Information "[winget] Installing" | |
Add-AppxPackage 'Microsoft.DesktopAppInstaller.msixbundle' -DependencyPath '.\Microsoft.UI.Xaml\tools\AppX\x64\Release\Microsoft.UI.Xaml.2.7.appx', '.\Microsoft.VCLibs.x64.14.Desktop.appx' | |
Pop-Location | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment