-
Notifications
You must be signed in to change notification settings - Fork 243
/
Install-WindowsSDK.ps1
34 lines (29 loc) · 1.12 KB
/
Install-WindowsSDK.ps1
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
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
function Write-Log ([string] $message, $messageColor = "Green") {
$currentColor = $Host.UI.RawUI.ForegroundColor
$Host.UI.RawUI.ForegroundColor = $messageColor
if ($message) {
Write-Output "... $message"
}
$Host.UI.RawUI.ForegroundColor = $currentColor
}
Push-Location
try {
Write-Log "Downloading the Windows SDK 10.0.14393.795..."
Invoke-WebRequest -Method Get -Uri https://go.microsoft.com/fwlink/p/?LinkId=838916 -OutFile sdksetup.exe -UseBasicParsing
Write-Log "Installing the Windows SDK, setup might request elevation please approve."
$process = Start-Process -Wait sdksetup.exe -ArgumentList "/quiet", "/norestart", "/ceip off", "/features OptionId.WindowsSoftwareDevelopmentKit" -PassThru
Remove-Item sdksetup.exe -Force
if($process.ExitCode -eq 0)
{
Write-Log "Done"
}
else
{
Write-Log "Failed (Exit code: $($process.ExitCode))" -messageColor "Red"
}
}
finally {
Pop-Location
}