2020-03-25 00:07:46 +03:00
|
|
|
# Copyright (c) Microsoft Corporation.
|
|
|
|
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2020-05-07 05:50:22 +03:00
|
|
|
|
|
|
|
<#
|
|
|
|
.SYNOPSIS
|
|
|
|
Sets up a machine to be an image for a scale set.
|
|
|
|
|
|
|
|
.DESCRIPTION
|
|
|
|
provision-image.ps1 runs on an existing, freshly provisioned virtual machine,
|
|
|
|
and sets up that virtual machine as a build machine. After this is done,
|
|
|
|
(outside of this script), we take that machine and make it an image to be copied
|
|
|
|
for setting up new VMs in the scale set.
|
|
|
|
|
|
|
|
This script must either be run as admin, or one must pass AdminUserPassword;
|
|
|
|
if the script is run with AdminUserPassword, it runs itself again as an
|
|
|
|
administrator.
|
|
|
|
|
|
|
|
.PARAMETER AdminUserPassword
|
|
|
|
The administrator user's password; if this is $null, or not passed, then the
|
|
|
|
script assumes it's running on an administrator account.
|
|
|
|
#>
|
2020-03-25 00:07:46 +03:00
|
|
|
param(
|
|
|
|
[string]$AdminUserPassword = $null
|
|
|
|
)
|
|
|
|
|
2020-05-07 05:50:22 +03:00
|
|
|
$ErrorActionPreference = 'Stop'
|
|
|
|
|
|
|
|
<#
|
|
|
|
.SYNOPSIS
|
|
|
|
Gets a random file path in the temp directory.
|
|
|
|
|
|
|
|
.DESCRIPTION
|
|
|
|
Get-TempFilePath takes an extension, and returns a path with a random
|
|
|
|
filename component in the temporary directory with that extension.
|
|
|
|
|
|
|
|
.PARAMETER Extension
|
|
|
|
The extension to use for the path.
|
|
|
|
#>
|
2020-04-10 04:46:00 +03:00
|
|
|
Function Get-TempFilePath {
|
|
|
|
Param(
|
|
|
|
[String]$Extension
|
|
|
|
)
|
|
|
|
|
|
|
|
if ([String]::IsNullOrWhiteSpace($Extension)) {
|
|
|
|
throw 'Missing Extension'
|
|
|
|
}
|
|
|
|
|
|
|
|
$tempPath = [System.IO.Path]::GetTempPath()
|
|
|
|
$tempName = [System.IO.Path]::GetRandomFileName() + '.' + $Extension
|
|
|
|
return Join-Path $tempPath $tempName
|
|
|
|
}
|
|
|
|
|
2021-01-22 04:11:58 +03:00
|
|
|
<#
|
|
|
|
.SYNOPSIS
|
|
|
|
Downloads and extracts a ZIP file to a newly created temporary subdirectory.
|
|
|
|
|
|
|
|
.DESCRIPTION
|
|
|
|
DownloadAndExtractZip returns a path containing the extracted contents.
|
|
|
|
|
|
|
|
.PARAMETER Url
|
|
|
|
The URL of the ZIP file to download.
|
|
|
|
#>
|
|
|
|
Function DownloadAndExtractZip {
|
|
|
|
Param(
|
|
|
|
[String]$Url
|
|
|
|
)
|
|
|
|
|
|
|
|
if ([String]::IsNullOrWhiteSpace($Url)) {
|
|
|
|
throw 'Missing Url'
|
|
|
|
}
|
|
|
|
|
|
|
|
$ZipPath = Get-TempFilePath -Extension 'zip'
|
|
|
|
& curl.exe -L -o $ZipPath -s -S $Url
|
|
|
|
$TempSubdirPath = Get-TempFilePath -Extension 'dir'
|
|
|
|
Expand-Archive -Path $ZipPath -DestinationPath $TempSubdirPath -Force
|
|
|
|
|
|
|
|
return $TempSubdirPath
|
|
|
|
}
|
|
|
|
|
2020-08-10 00:56:45 +03:00
|
|
|
$TranscriptPath = 'C:\provision-image-transcript.txt'
|
|
|
|
|
|
|
|
if ([string]::IsNullOrEmpty($AdminUserPassword)) {
|
2021-01-22 04:11:58 +03:00
|
|
|
Start-Transcript -Path $TranscriptPath -UseMinimalHeader
|
2020-08-10 00:56:45 +03:00
|
|
|
} else {
|
|
|
|
Write-Host 'AdminUser password supplied; switching to AdminUser.'
|
2021-01-22 04:11:58 +03:00
|
|
|
|
|
|
|
# https://docs.microsoft.com/en-us/sysinternals/downloads/psexec
|
|
|
|
$PsToolsZipUrl = 'https://download.sysinternals.com/files/PSTools.zip'
|
|
|
|
Write-Host "Downloading: $PsToolsZipUrl"
|
|
|
|
$ExtractedPsToolsPath = DownloadAndExtractZip -Url $PsToolsZipUrl
|
|
|
|
$PsExecPath = Join-Path $ExtractedPsToolsPath 'PsExec64.exe'
|
|
|
|
|
|
|
|
# https://github.com/PowerShell/PowerShell/releases/latest
|
2021-05-01 04:19:31 +03:00
|
|
|
$PowerShellZipUrl = 'https://github.com/PowerShell/PowerShell/releases/download/v7.1.3/PowerShell-7.1.3-win-x64.zip'
|
2021-01-22 04:11:58 +03:00
|
|
|
Write-Host "Downloading: $PowerShellZipUrl"
|
|
|
|
$ExtractedPowerShellPath = DownloadAndExtractZip -Url $PowerShellZipUrl
|
|
|
|
$PwshPath = Join-Path $ExtractedPowerShellPath 'pwsh.exe'
|
|
|
|
|
2020-03-25 00:07:46 +03:00
|
|
|
$PsExecArgs = @(
|
|
|
|
'-u',
|
|
|
|
'AdminUser',
|
|
|
|
'-p',
|
2021-01-22 04:11:58 +03:00
|
|
|
'AdminUserPassword_REDACTED',
|
2020-03-25 00:07:46 +03:00
|
|
|
'-accepteula',
|
2021-01-22 04:11:58 +03:00
|
|
|
'-i',
|
2020-03-25 00:07:46 +03:00
|
|
|
'-h',
|
2021-01-22 04:11:58 +03:00
|
|
|
$PwshPath,
|
2020-03-25 00:07:46 +03:00
|
|
|
'-ExecutionPolicy',
|
|
|
|
'Unrestricted',
|
|
|
|
'-File',
|
|
|
|
$PSCommandPath
|
|
|
|
)
|
2020-08-10 00:56:45 +03:00
|
|
|
Write-Host "Executing: $PsExecPath $PsExecArgs"
|
2021-01-22 04:11:58 +03:00
|
|
|
$PsExecArgs[3] = $AdminUserPassword
|
2020-04-10 04:46:00 +03:00
|
|
|
|
|
|
|
$proc = Start-Process -FilePath $PsExecPath -ArgumentList $PsExecArgs -Wait -PassThru
|
2020-08-10 00:56:45 +03:00
|
|
|
Write-Host 'Reading transcript...'
|
|
|
|
Get-Content -Path $TranscriptPath
|
2020-05-07 05:50:22 +03:00
|
|
|
Write-Host 'Cleaning up...'
|
2021-01-22 04:11:58 +03:00
|
|
|
Remove-Item -Recurse -Path $ExtractedPsToolsPath
|
|
|
|
Remove-Item -Recurse -Path $ExtractedPowerShellPath
|
2020-04-10 04:46:00 +03:00
|
|
|
exit $proc.ExitCode
|
2020-03-25 00:07:46 +03:00
|
|
|
}
|
|
|
|
|
2020-04-10 04:46:00 +03:00
|
|
|
$Workloads = @(
|
|
|
|
'Microsoft.VisualStudio.Component.VC.CLI.Support',
|
2020-08-10 00:56:45 +03:00
|
|
|
'Microsoft.VisualStudio.Component.VC.CMake.Project',
|
2020-04-10 04:46:00 +03:00
|
|
|
'Microsoft.VisualStudio.Component.VC.CoreIde',
|
2020-08-10 00:56:45 +03:00
|
|
|
'Microsoft.VisualStudio.Component.VC.Llvm.Clang',
|
2020-11-14 00:29:26 +03:00
|
|
|
'Microsoft.VisualStudio.Component.VC.Runtimes.ARM.Spectre',
|
|
|
|
'Microsoft.VisualStudio.Component.VC.Runtimes.ARM64.Spectre',
|
|
|
|
'Microsoft.VisualStudio.Component.VC.Runtimes.x86.x64.Spectre',
|
2020-04-10 04:46:00 +03:00
|
|
|
'Microsoft.VisualStudio.Component.VC.Tools.ARM',
|
2020-08-10 00:56:45 +03:00
|
|
|
'Microsoft.VisualStudio.Component.VC.Tools.ARM64',
|
|
|
|
'Microsoft.VisualStudio.Component.VC.Tools.x86.x64',
|
2021-07-20 03:53:06 +03:00
|
|
|
# TRANSITION, LLVM-51128 (Clang 12 targeting ARM64 is incompatible with WinSDK 10.0.20348.0)
|
2020-08-10 00:56:45 +03:00
|
|
|
'Microsoft.VisualStudio.Component.Windows10SDK.19041'
|
2020-04-10 04:46:00 +03:00
|
|
|
)
|
2020-03-25 00:07:46 +03:00
|
|
|
|
|
|
|
$ReleaseInPath = 'Preview'
|
|
|
|
$Sku = 'Enterprise'
|
2021-07-20 03:53:06 +03:00
|
|
|
$VisualStudioBootstrapperUrl = 'https://aka.ms/vs/17/pre/vs_enterprise.exe'
|
|
|
|
$PythonUrl = 'https://www.python.org/ftp/python/3.9.6/python-3.9.6-amd64.exe'
|
2020-03-25 00:07:46 +03:00
|
|
|
|
2020-11-14 00:29:26 +03:00
|
|
|
# https://docs.microsoft.com/en-us/windows-hardware/drivers/download-the-wdk
|
|
|
|
$WindowsDriverKitUrl = 'https://go.microsoft.com/fwlink/?linkid=2128854'
|
|
|
|
|
2020-08-26 11:18:26 +03:00
|
|
|
$CudaUrl = `
|
|
|
|
'https://developer.download.nvidia.com/compute/cuda/10.1/Prod/local_installers/cuda_10.1.243_426.00_win10.exe'
|
2020-04-10 04:46:00 +03:00
|
|
|
$CudaFeatures = 'nvcc_10.1 cuobjdump_10.1 nvprune_10.1 cupti_10.1 gpu_library_advisor_10.1 memcheck_10.1 ' + `
|
|
|
|
'nvdisasm_10.1 nvprof_10.1 visual_profiler_10.1 visual_studio_integration_10.1 cublas_10.1 cublas_dev_10.1 ' + `
|
|
|
|
'cudart_10.1 cufft_10.1 cufft_dev_10.1 curand_10.1 curand_dev_10.1 cusolver_10.1 cusolver_dev_10.1 cusparse_10.1 ' + `
|
|
|
|
'cusparse_dev_10.1 nvgraph_10.1 nvgraph_dev_10.1 npp_10.1 npp_dev_10.1 nvrtc_10.1 nvrtc_dev_10.1 nvml_dev_10.1 ' + `
|
|
|
|
'occupancy_calculator_10.1 fortran_examples_10.1'
|
|
|
|
|
2020-03-25 00:07:46 +03:00
|
|
|
$ErrorActionPreference = 'Stop'
|
|
|
|
$ProgressPreference = 'SilentlyContinue'
|
|
|
|
|
2020-05-07 05:50:22 +03:00
|
|
|
<#
|
|
|
|
.SYNOPSIS
|
|
|
|
Writes a message to the screen depending on ExitCode.
|
|
|
|
|
|
|
|
.DESCRIPTION
|
|
|
|
Since msiexec can return either 0 or 3010 successfully, in both cases
|
|
|
|
we write that installation succeeded, and which exit code it exited with.
|
|
|
|
If msiexec returns anything else, we write an error.
|
|
|
|
|
|
|
|
.PARAMETER ExitCode
|
|
|
|
The exit code that msiexec returned.
|
|
|
|
#>
|
2020-03-25 00:07:46 +03:00
|
|
|
Function PrintMsiExitCodeMessage {
|
|
|
|
Param(
|
|
|
|
$ExitCode
|
|
|
|
)
|
|
|
|
|
2020-05-07 05:50:22 +03:00
|
|
|
# 3010 is probably ERROR_SUCCESS_REBOOT_REQUIRED
|
2020-03-25 00:07:46 +03:00
|
|
|
if ($ExitCode -eq 0 -or $ExitCode -eq 3010) {
|
2020-05-07 05:50:22 +03:00
|
|
|
Write-Host "Installation successful! Exited with $ExitCode."
|
2020-03-25 00:07:46 +03:00
|
|
|
}
|
|
|
|
else {
|
2020-05-07 05:50:22 +03:00
|
|
|
Write-Error "Installation failed! Exited with $ExitCode."
|
2020-03-25 00:07:46 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-07 05:50:22 +03:00
|
|
|
<#
|
|
|
|
.SYNOPSIS
|
|
|
|
Install Visual Studio.
|
|
|
|
|
|
|
|
.DESCRIPTION
|
|
|
|
InstallVisualStudio takes the $Workloads array, and installs it with the
|
|
|
|
installer that's pointed at by $BootstrapperUrl.
|
|
|
|
|
|
|
|
.PARAMETER Workloads
|
|
|
|
The set of VS workloads to install.
|
|
|
|
|
|
|
|
.PARAMETER BootstrapperUrl
|
|
|
|
The URL of the Visual Studio installer, i.e. one of vs_*.exe.
|
|
|
|
|
|
|
|
.PARAMETER InstallPath
|
|
|
|
The path to install Visual Studio at.
|
|
|
|
|
|
|
|
.PARAMETER Nickname
|
|
|
|
The nickname to give the installation.
|
|
|
|
#>
|
2020-03-25 00:07:46 +03:00
|
|
|
Function InstallVisualStudio {
|
|
|
|
Param(
|
2020-04-10 04:46:00 +03:00
|
|
|
[String[]]$Workloads,
|
|
|
|
[String]$BootstrapperUrl,
|
|
|
|
[String]$InstallPath = $null,
|
|
|
|
[String]$Nickname = $null
|
2020-03-25 00:07:46 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
try {
|
2020-05-07 05:50:22 +03:00
|
|
|
Write-Host 'Downloading Visual Studio...'
|
2020-04-10 04:46:00 +03:00
|
|
|
[string]$bootstrapperExe = Get-TempFilePath -Extension 'exe'
|
|
|
|
curl.exe -L -o $bootstrapperExe -s -S $BootstrapperUrl
|
2020-08-10 00:56:45 +03:00
|
|
|
Write-Host 'Installing Visual Studio...'
|
2020-04-10 04:46:00 +03:00
|
|
|
$args = @('/c', $bootstrapperExe, '--quiet', '--norestart', '--wait', '--nocache')
|
|
|
|
foreach ($workload in $Workloads) {
|
|
|
|
$args += '--add'
|
|
|
|
$args += $workload
|
|
|
|
}
|
|
|
|
|
|
|
|
if (-not ([String]::IsNullOrWhiteSpace($InstallPath))) {
|
|
|
|
$args += '--installpath'
|
|
|
|
$args += $InstallPath
|
|
|
|
}
|
|
|
|
|
|
|
|
if (-not ([String]::IsNullOrWhiteSpace($Nickname))) {
|
|
|
|
$args += '--nickname'
|
|
|
|
$args += $Nickname
|
|
|
|
}
|
|
|
|
|
2020-03-25 00:07:46 +03:00
|
|
|
$proc = Start-Process -FilePath cmd.exe -ArgumentList $args -Wait -PassThru
|
|
|
|
PrintMsiExitCodeMessage $proc.ExitCode
|
|
|
|
}
|
|
|
|
catch {
|
2020-05-07 05:50:22 +03:00
|
|
|
Write-Error "Failed to install Visual Studio! $($_.Exception.Message)"
|
2020-03-25 00:07:46 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-07 05:50:22 +03:00
|
|
|
<#
|
|
|
|
.SYNOPSIS
|
|
|
|
Installs Python.
|
|
|
|
|
|
|
|
.DESCRIPTION
|
|
|
|
InstallPython installs Python from the supplied URL.
|
|
|
|
|
|
|
|
.PARAMETER Url
|
|
|
|
The URL of the Python installer.
|
|
|
|
#>
|
2020-03-25 00:07:46 +03:00
|
|
|
Function InstallPython {
|
|
|
|
Param(
|
|
|
|
[String]$Url
|
|
|
|
)
|
|
|
|
|
2020-05-07 05:50:22 +03:00
|
|
|
Write-Host 'Downloading Python...'
|
2020-04-10 04:46:00 +03:00
|
|
|
[string]$installerPath = Get-TempFilePath -Extension 'exe'
|
|
|
|
curl.exe -L -o $installerPath -s -S $Url
|
2020-05-07 05:50:22 +03:00
|
|
|
Write-Host 'Installing Python...'
|
2020-03-25 00:07:46 +03:00
|
|
|
$proc = Start-Process -FilePath $installerPath -ArgumentList `
|
|
|
|
@('/passive', 'InstallAllUsers=1', 'PrependPath=1', 'CompileAll=1') -Wait -PassThru
|
|
|
|
$exitCode = $proc.ExitCode
|
|
|
|
if ($exitCode -eq 0) {
|
2020-05-07 05:50:22 +03:00
|
|
|
Write-Host 'Installation successful!'
|
2020-03-25 00:07:46 +03:00
|
|
|
}
|
|
|
|
else {
|
2020-05-07 05:50:22 +03:00
|
|
|
Write-Error "Installation failed! Exited with $exitCode."
|
2020-03-25 00:07:46 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-11-14 00:29:26 +03:00
|
|
|
<#
|
|
|
|
.SYNOPSIS
|
|
|
|
Installs the Windows Driver Kit.
|
|
|
|
|
|
|
|
.DESCRIPTION
|
|
|
|
InstallWindowsDriverKit installs the Windows Driver Kit from the supplied URL.
|
|
|
|
|
|
|
|
.PARAMETER Url
|
|
|
|
The URL of the Windows Driver Kit installer.
|
|
|
|
#>
|
|
|
|
Function InstallWindowsDriverKit {
|
|
|
|
Param(
|
|
|
|
[String]$Url
|
|
|
|
)
|
|
|
|
|
|
|
|
Write-Host 'Downloading the Windows Driver Kit...'
|
|
|
|
[string]$installerPath = Get-TempFilePath -Extension 'exe'
|
|
|
|
curl.exe -L -o $installerPath -s -S $Url
|
|
|
|
Write-Host 'Installing the Windows Driver Kit...'
|
Toolset update: VS 2019 16.9 Preview 2 with Clang 11
* Fix #1471 by properly waiting for the Windows Driver Kit installation to finish.
* Update `azure-pipelines.yml` to use the new pool `StlBuild-2020-12-08`.
* Update `README.md` to mention Preview 2. (Its CMake and Ninja versions haven't changed,
and we don't directly mention the Clang version.)
* Update `yvals_core.h` to require Clang 11. (Note that MSVC's `_MSC_VER` is remaining `1928` for the 16.9 release.)
* Remove the workaround for LLVM-37556. (We were treating it as an uncommented perma-workaround, but I remembered.)
* Remove many workarounds in `P1502R1_standard_library_header_units`.
* Remove the VSO-1225825 workaround in `<iterator>` and `<ranges>`.
* Unrelated cleanup in `<valarray>`: `__cpp_aligned_new` implies `if constexpr`.
* Update the vcpkg submodule for Boost 1.74.0. This is just their latest commit.
* In `CMakeLists.txt`, require Boost 1.74.0. (This, combined with the toolset update,
implies that contributors will need to `git submodule update`, clean out the `vcpkg`
submodule with `git clean -x -d -f`, and then bootstrap vcpkg and build boost-math.)
* Simplify conditional operators in `seed_seq::generate`.
+ Thanks to @AlexGuteniev for suggesting extracting `_Off` and noticing
that `_Myvec[(_Kx - 1) % _Sx]` was unnecessarily complicated. Given `_Kx` in `[1, _Sx]`,
then `_Kx - 1` is in `[0, _Sx - 1]`, so `% _Sx` does nothing.
* Take advantage of clang-format 11. This sets `AlignOperands: AlignAfterOperator` and `IndentCaseBlocks: true`.
2020-12-03 05:19:14 +03:00
|
|
|
$proc = Start-Process -FilePath cmd.exe -ArgumentList `
|
|
|
|
@('/c', 'start', '/wait', $installerPath, '/quiet', '/features', '+') -Wait -PassThru
|
2020-11-14 00:29:26 +03:00
|
|
|
$exitCode = $proc.ExitCode
|
|
|
|
if ($exitCode -eq 0) {
|
|
|
|
Write-Host 'Installation successful!'
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
Write-Error "Installation failed! Exited with $exitCode."
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-07 05:50:22 +03:00
|
|
|
<#
|
|
|
|
.SYNOPSIS
|
|
|
|
Installs NVIDIA's CUDA Toolkit.
|
|
|
|
|
|
|
|
.DESCRIPTION
|
|
|
|
InstallCuda installs the CUDA Toolkit with the features specified as a
|
|
|
|
space-separated list of strings in $Features.
|
|
|
|
|
|
|
|
.PARAMETER Url
|
|
|
|
The URL of the CUDA installer.
|
|
|
|
|
|
|
|
.PARAMETER Features
|
|
|
|
A space-separated list of features to install.
|
|
|
|
#>
|
2020-04-10 04:46:00 +03:00
|
|
|
Function InstallCuda {
|
|
|
|
Param(
|
|
|
|
[String]$Url,
|
|
|
|
[String]$Features
|
|
|
|
)
|
|
|
|
|
|
|
|
try {
|
2020-05-07 05:50:22 +03:00
|
|
|
Write-Host 'Downloading CUDA...'
|
2020-04-10 04:46:00 +03:00
|
|
|
[string]$installerPath = Get-TempFilePath -Extension 'exe'
|
|
|
|
curl.exe -L -o $installerPath -s -S $Url
|
2020-05-07 05:50:22 +03:00
|
|
|
Write-Host 'Installing CUDA...'
|
2020-04-10 04:46:00 +03:00
|
|
|
$proc = Start-Process -FilePath $installerPath -ArgumentList @('-s ' + $Features) -Wait -PassThru
|
|
|
|
$exitCode = $proc.ExitCode
|
|
|
|
if ($exitCode -eq 0) {
|
2020-05-07 05:50:22 +03:00
|
|
|
Write-Host 'Installation successful!'
|
2020-04-10 04:46:00 +03:00
|
|
|
}
|
|
|
|
else {
|
2020-05-07 05:50:22 +03:00
|
|
|
Write-Error "Installation failed! Exited with $exitCode."
|
2020-04-10 04:46:00 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
catch {
|
2020-05-07 05:50:22 +03:00
|
|
|
Write-Error "Failed to install CUDA! $($_.Exception.Message)"
|
2020-04-10 04:46:00 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-07-09 02:46:25 +03:00
|
|
|
<#
|
|
|
|
.SYNOPSIS
|
|
|
|
Install or upgrade a pip package.
|
|
|
|
|
|
|
|
.DESCRIPTION
|
|
|
|
Installs or upgrades a pip package specified in $Package.
|
|
|
|
|
|
|
|
.PARAMETER Package
|
|
|
|
The name of the package to be installed or upgraded.
|
|
|
|
#>
|
|
|
|
Function PipInstall {
|
|
|
|
Param(
|
|
|
|
[String]$Package
|
|
|
|
)
|
|
|
|
|
|
|
|
try {
|
2020-08-10 00:56:45 +03:00
|
|
|
Write-Host "Installing or upgrading $Package..."
|
2021-01-22 04:11:58 +03:00
|
|
|
python.exe -m pip install --progress-bar off --upgrade $Package
|
2020-08-10 00:56:45 +03:00
|
|
|
Write-Host "Done installing or upgrading $Package."
|
2020-07-09 02:46:25 +03:00
|
|
|
}
|
|
|
|
catch {
|
2020-08-10 00:56:45 +03:00
|
|
|
Write-Error "Failed to install or upgrade $Package."
|
2020-07-09 02:46:25 +03:00
|
|
|
}
|
|
|
|
}
|
2020-03-25 00:07:46 +03:00
|
|
|
|
2020-08-10 00:56:45 +03:00
|
|
|
Write-Host 'AdminUser password not supplied; assuming already running as AdminUser.'
|
2020-03-29 04:53:15 +03:00
|
|
|
|
2020-04-10 04:46:00 +03:00
|
|
|
Write-Host 'Configuring AntiVirus exclusions...'
|
2020-05-07 05:50:22 +03:00
|
|
|
Add-MpPreference -ExclusionPath C:\agent
|
|
|
|
Add-MpPreference -ExclusionPath D:\
|
|
|
|
Add-MpPreference -ExclusionProcess ninja.exe
|
|
|
|
Add-MpPreference -ExclusionProcess clang-cl.exe
|
|
|
|
Add-MpPreference -ExclusionProcess cl.exe
|
|
|
|
Add-MpPreference -ExclusionProcess link.exe
|
|
|
|
Add-MpPreference -ExclusionProcess python.exe
|
2020-03-29 04:53:15 +03:00
|
|
|
|
2020-04-10 04:46:00 +03:00
|
|
|
InstallPython $PythonUrl
|
|
|
|
InstallVisualStudio -Workloads $Workloads -BootstrapperUrl $VisualStudioBootstrapperUrl
|
2020-11-14 00:29:26 +03:00
|
|
|
InstallWindowsDriverKit $WindowsDriverKitUrl
|
2020-04-10 04:46:00 +03:00
|
|
|
InstallCuda -Url $CudaUrl -Features $CudaFeatures
|
2020-07-09 02:46:25 +03:00
|
|
|
|
2020-05-07 05:50:22 +03:00
|
|
|
Write-Host 'Updating PATH...'
|
2020-08-10 00:56:45 +03:00
|
|
|
|
|
|
|
# Step 1: Read the system path, which was just updated by installing Python.
|
2020-04-10 04:46:00 +03:00
|
|
|
$environmentKey = Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment' -Name Path
|
2020-08-10 00:56:45 +03:00
|
|
|
|
|
|
|
# Step 2: Update the local path (for this running script), so PipInstall can run python.exe.
|
|
|
|
# Additional directories can be added here (e.g. if we extracted a zip file
|
|
|
|
# or installed something that didn't update the system path).
|
|
|
|
$Env:PATH="$($environmentKey.Path)"
|
|
|
|
|
|
|
|
# Step 3: Update the system path, permanently recording any additional directories that were added in the previous step.
|
2020-04-10 04:46:00 +03:00
|
|
|
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment' `
|
|
|
|
-Name Path `
|
2020-07-09 02:46:25 +03:00
|
|
|
-Value "$Env:PATH"
|
|
|
|
|
2020-08-10 00:56:45 +03:00
|
|
|
Write-Host 'Finished updating PATH!'
|
|
|
|
|
2020-07-09 02:46:25 +03:00
|
|
|
PipInstall pip
|
|
|
|
PipInstall psutil
|
2021-01-22 04:11:58 +03:00
|
|
|
|
|
|
|
# https://docs.microsoft.com/en-us/windows-hardware/drivers/devtest/bcdedit--set#verification-settings
|
|
|
|
Write-Host 'Enabling test-signed kernel-mode drivers...'
|
|
|
|
bcdedit /set testsigning on
|
|
|
|
|
|
|
|
Write-Host 'Done!'
|