Skip to content

Instantly share code, notes, and snippets.

@thedaveCA
thedaveCA / bootstrap-winget.ps1
Last active March 28, 2025 20:49
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" }
### Label messages with ${domain}.${mailbox}
#
# This is overkill, but read the preamble and then look for the "configuration"
#
### PREAMBLE
#
# Fastmail uses . as a folder separator, and ^ as a literal dot. Ugh.
#
# X-Delivered-To header is used to determine the actual destination of the
# message after alias processing. If you wanted the raw RCPT TO, try: