Last active
August 14, 2018 12:08
-
-
Save sonjz/5a666e8a24dd71387ee355269be8d1de to your computer and use it in GitHub Desktop.
Installs Enhanced Network Drivers for AWS, be sure you are using a supported instance type: https://aws.amazon.com/ec2/instance-types/#instance-type-matrix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Author: jason.huggins@gmail.com | |
# Created: 2017-03-04 | |
# Description: Installs Enhanced Network Drivers for AWS, be sure you are using a supported instance type: | |
# https://aws.amazon.com/ec2/instance-types/#instance-type-matrix | |
# | |
# Quick Usage: | |
# Install-AWSEnhancedNetworkingDrivers.ps1 ; | |
# Install-AWSEnhancedNetworkingDrivers | |
# Prerequisites | |
# ------------- | |
# Allow scripts to run | |
Set-ExecutionPolicy Bypass ; | |
# Install Chocolatey | |
iwr https://chocolatey.org/install.ps1 -UseBasicParsing | iex ; | |
# Install Powershell 5+ | |
# NOTE: may require reboot, if you are on Windows 10 you can skip this step | |
choco install powershell -y ; | |
# install 7zip | |
choco install 7zip -y ; | |
function Get-Url { | |
param( | |
[string]$url, # e.g. "http://bitbucket.org/tortoisehg/files/downloads/tortoisehg-2.11-hg-2.9-x64.msi" | |
[string]$filepath, # e.g. "d:\scripts\bin\tortoisehg.msi" | |
[string]$credentials # e.g. username:pass | |
) | |
Write-Host "Getting url $url to $filepath ... " ; | |
$client = New-Object System.Net.WebClient; | |
if ($credentials) { | |
$credentialsB64 = [System.Text.Encoding]::UTF8.GetBytes($credentials) ; | |
$credentialsB64 = [System.Convert]::ToBase64String($credentialsB64) ; | |
$client.Headers.Add("Authorization", "Basic " + $credentialsB64) ; | |
} | |
$client.DownloadFile($url, $filepath); | |
} | |
# NOTE: Must be run on an instance with c4.large or equivalent for supporting Enhanced Networking | |
function Install-AWSEnhancedNetworkingDrivers { | |
param( | |
[String]$tempFolder = $env:temp, | |
[String]$url = "https://downloadmirror.intel.com/23073/eng/PROWinx64.exe", | |
[String]$exeSetup = "PROWinx64\Apps\PROSETDX\Winx64\DxSetup.exe", | |
[String]$exe7z = "C:\Program Files\7-Zip\7z.exe" | |
) | |
Write-Host "Installing Enhanced Networking drivers ... " ; | |
Write-Host "NOTE: Must be using a c4.large or other Enhanced Networking supported instance otherwise drivers won't be installed!" | |
$binFolder = "$tempFolder\bin" ; | |
$filename = Split-Path $url -Leaf ; | |
# pull down Intel Driver installer | |
mkdir $binFolder -force ; | |
Get-Url ` | |
-url "$($url)?r=$(Get-Random)" ` | |
-filepath "$binFolder\$filename" ; | |
# extract with 7zip | |
&$exe7z x "$binFolder\$filename" -o"$binFolder\$($exeSetup.Split('\')[0])" -y | |
# thread the install | |
Start-Process ` | |
-FilePath "$binFolder\$exeSetup" ` | |
-ArgumentList @("/passive") ` | |
-Wait ; | |
# safe wait ... | |
Start-Sleep ` | |
-s 5 ; | |
} | |
# executes install | |
Install-AWSEnhancedNetworkingDrivers ; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment