Skip to content

Instantly share code, notes, and snippets.

@lzybkr
Last active February 27, 2025 00:15
Show Gist options
  • Save lzybkr/a39f6c07be4891ee9fac6bf6eb13893e to your computer and use it in GitHub Desktop.
Save lzybkr/a39f6c07be4891ee9fac6bf6eb13893e to your computer and use it in GitHub Desktop.
Download and extract the latest WinDbg without installing so you can run on systems like Windows Server
param(
$OutDir = ".",
[ValidateSet("x64", "x86", "arm64")]
$Arch = "x64"
)
if (!(Test-Path $OutDir)) {
$null = mkdir $OutDir
}
# Download the appinstaller to find the current uri for the msixbundle
Invoke-WebRequest https://aka.ms/windbg/download -OutFile $OutDir\windbg.appinstaller
# Download the msixbundle
$msixBundleUri = ([xml](Get-Content $OutDir\windbg.appinstaller)).AppInstaller.MainBundle.Uri
if ($PSVersionTable.PSVersion.Major -lt 6) {
# This is a workaround to get better performance on older versions of PowerShell
$ProgressPreference = 'SilentlyContinue'
}
# Download the msixbundle (but name as zip for older versions of Expand-Archive
Invoke-WebRequest $msixBundleUri -OutFile $OutDir\windbg.zip
# Extract the 3 msix files (plus other files)
Expand-Archive -DestinationPath $OutDir\UnzippedBundle $OutDir\windbg.zip
# Rename msix (for older versions of Expand-Archive) and extract the debugger
Move-Item "$OutDir\UnzippedBundle\windbg_win-$Arch.msix" "$OutDir\UnzippedBundle\windbg_win-$Arch.zip"
Expand-Archive -Path "$OutDir\UnzippedBundle\windbg_win-$Arch.zip" -DestinationPath "$OutDir\windbg"
# Now you can run:
& $OutDir\windbg\DbgX.Shell.exe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment