Skip to content

Instantly share code, notes, and snippets.

@sonjz
Last active August 14, 2018 12:08
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sonjz/5a666e8a24dd71387ee355269be8d1de to your computer and use it in GitHub Desktop.
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
# 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