blob: d145f79d71a8ecec2a3f523dee67b722f654bd7c (
plain)
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
|
# Copyright (c) Microsoft Corporation.
# SPDX-License-Identifier: MIT
# REPLACE WITH DROP-TO-ADMIN-USER-PREFIX.ps1
# REPLACE WITH UTILITY-PREFIX.ps1
$WindowsWDKUrl = 'https://go.microsoft.com/fwlink/?linkid=2128854'
<#
.SYNOPSIS
Installs Windows WDK version 2004
.DESCRIPTION
Downloads the Windows WDK installer located at $Url, and installs it with the
correct flags.
.PARAMETER Url
The URL of the installer.
#>
Function InstallWindowsWDK {
Param(
[String]$Url
)
try {
Write-Host 'Downloading Windows WDK...'
[string]$installerPath = Get-TempFilePath -Extension 'exe'
curl.exe -L -o $installerPath -s -S $Url
Write-Host 'Installing Windows WDK...'
$proc = Start-Process -FilePath $installerPath -ArgumentList @('/features', '+', '/q') -Wait -PassThru
$exitCode = $proc.ExitCode
if ($exitCode -eq 0) {
Write-Host 'Installation successful!'
}
else {
Write-Error "Installation failed! Exited with $exitCode."
throw
}
}
catch {
Write-Error "Failed to install Windows WDK! $($_.Exception.Message)"
throw
}
}
InstallWindowsWDK -Url $WindowsWDKUrl
|