1 # Copyright (c) Microsoft Corporation.
2 # SPDX-License-Identifier: MIT
4 # REPLACE WITH DROP-TO-ADMIN-USER-PREFIX.ps1
6 # REPLACE WITH UTILITY-PREFIX.ps1
8 $WindowsWDKUrl = 'https://go.microsoft.com/fwlink/?linkid=2128854'
12 Installs Windows WDK version 2004
15 Downloads the Windows WDK installer located at $Url, and installs it with the
19 The URL of the installer.
21 Function InstallWindowsWDK {
27 Write-Host 'Downloading Windows WDK...'
28 [string]$installerPath = Get-TempFilePath -Extension 'exe'
29 curl.exe -L -o $installerPath -s -S $Url
30 Write-Host 'Installing Windows WDK...'
31 $proc = Start-Process -FilePath $installerPath -ArgumentList @('/features', '+', '/q') -Wait -PassThru
32 $exitCode = $proc.ExitCode
33 if ($exitCode -eq 0) {
34 Write-Host 'Installation successful!'
37 Write-Error "Installation failed! Exited with $exitCode."
42 Write-Error "Failed to install Windows WDK! $($_.Exception.Message)"
47 InstallWindowsWDK -Url $WindowsWDKUrl