github.com/iqoqo/nomad@v0.11.3-0.20200911112621-d7021c74d101/e2e/terraform/packer/windows/install-tools.ps1 (about)

     1  Set-StrictMode -Version latest
     2  $ErrorActionPreference = "Stop"
     3  
     4  $RunningAsAdmin = ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")
     5  if (!$RunningAsAdmin) {
     6    Write-Error "Must be executed in Administrator level shell."
     7    exit 1
     8  }
     9  
    10  # Force TLS1.2
    11  [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
    12  
    13  # TODO (tgross: some stuff installed on Linux but not here yet
    14  # - Possible issues: no redis-tools for windows
    15  # - Possible non-issues: probably don't need tree, curl,tmux
    16  
    17  Try {
    18      Set-PSRepository -InstallationPolicy Trusted -Name PSGallery
    19  
    20      Write-Output "Installing 7Zip"
    21      Install-Package -Force 7Zip4PowerShell
    22  
    23      Write-Output "Installing JQ"
    24      Invoke-WebRequest `
    25        -Uri https://github.com/stedolan/jq/releases/download/jq-1.6/jq-win64.exe `
    26        -Outfile jq-win64.exe
    27  
    28  } Catch {
    29      Write-Error "Failed to install dependencies."
    30      $host.SetShouldExit(-1)
    31      throw
    32  } Finally {
    33      # clean up by re-securing this package repo
    34      Set-PSRepository -InstallationPolicy Untrusted -Name PSGallery
    35  }
    36  
    37  Write-Output "Installed dependencies"