Last active
March 28, 2025 20:49
-
-
Save thedaveCA/4b312e32958497bd66eaf5c9b634961e to your computer and use it in GitHub Desktop.
Windows 10 (and maybe 11) sometimes requires Windows Store to install DesktopAppInstall before WinGet works. Try this PowerShell to do simliar from script.
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
| ## Windows 10 (and maybe 11) sometimes requires Windows Store to install DesktopAppInstall before WinGet works. Try this PowerShell to do simliar from script. | |
| $winget = $null | |
| $DesktopAppInstaller = "C:\Program Files\WindowsApps\Microsoft.DesktopAppInstaller_*_x64__8wekyb3d8bbwe" | |
| $SystemContext = Resolve-Path "$DesktopAppInstaller" | |
| if ($SystemContext) { $SystemContext = $SystemContext[-1].Path } | |
| $UserContext = Get-Command winget.exe -ErrorAction SilentlyContinue | |
| if ($UserContext) { $winget = $UserContext.Source } | |
| elseif (Test-Path "$SystemContext\AppInstallerCLI.exe") { $winget = "$SystemContext\AppInstallerCLI.exe" } | |
| elseif (Test-Path "$SystemContext\winget.exe") { $winget = "$SystemContext\winget.exe" } | |
| else { return $false } | |
| Start-Process -FilePath $winget -ArgumentList "install --id '9NBLGGH4NNS1' --silent --accept-package-agreements --accept-source-agreements --source msstore --scope machine" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment