Skip to content

Instantly share code, notes, and snippets.

@thedaveCA
Last active March 28, 2025 20:49
Show Gist options
  • Select an option

  • Save thedaveCA/4b312e32958497bd66eaf5c9b634961e to your computer and use it in GitHub Desktop.

Select an option

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.
## 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