08ae13d3b9
Small changes to the Windows 2016 Packer build for debuggability of provisioning: * improve verbosity of powershell error handling * remove unused "tools" installation * use ssh communicator for Packer to improve Packer build times and eliminate deprecated winrm remote access (unavailable from current macOS)
23 lines
694 B
PowerShell
Executable file
23 lines
694 B
PowerShell
Executable file
Set-StrictMode -Version latest
|
|
$ErrorActionPreference = "Stop"
|
|
|
|
$RunningAsAdmin = ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")
|
|
if (!$RunningAsAdmin) {
|
|
Write-Error "Must be executed in Administrator level shell."
|
|
exit 1
|
|
}
|
|
|
|
# Force TLS1.2
|
|
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
|
|
|
Try {
|
|
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force -ErrorAction Stop
|
|
} Catch {
|
|
Write-Output "Failed to install NuGet package manager."
|
|
Write-Output $_
|
|
$host.SetShouldExit(-1)
|
|
throw
|
|
}
|
|
|
|
Write-Output "Installed NuGet."
|