-
Notifications
You must be signed in to change notification settings - Fork 72
/
Copy pathwindbg-install.ps1.txt
50 lines (37 loc) · 1.77 KB
/
windbg-install.ps1.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# script created by @Izybkr (https://github.com/microsoftfeedback/WinDbg-Feedback/issues/19#issuecomment-1513926394) with my minor updates to make it work with latest WinDbg releases):
param(
$OutDir = ".",
[ValidateSet("x64", "x86", "arm64")]
$Arch = "x64"
)
if (!(Test-Path $OutDir)) {
$null = mkdir $OutDir
}
$ErrorActionPreference = "Stop"
if ($PSVersionTable.PSVersion.Major -le 5) {
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
# This is a workaround to get better performance on older versions of PowerShell
$ProgressPreference = 'SilentlyContinue'
}
# 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
# 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
# Expand the build you want - also renaming the msix to zip for Windows PowerShell
$fileName = switch ($Arch) {
"x64" { "windbg_win-x64" }
"x86" { "windbg_win-x86" }
"arm64" { "windbg_win-arm64" }
}
# Rename msix (for older versions of Expand-Archive) and extract the debugger
Rename-Item "$OutDir\UnzippedBundle\$fileName.msix" "$fileName.zip"
Expand-Archive -DestinationPath "$OutDir\windbg" "$OutDir\UnzippedBundle\$fileName.zip"
Remove-Item -Recurse -Force "$OutDir\UnzippedBundle"
Remove-Item -Force "$OutDir\windbg.appinstaller"
Remove-Item -Force "$OutDir\windbg.zip"
# Now you can run:
& $OutDir\windbg\DbgX.Shell.exe