Skip to content

Instantly share code, notes, and snippets.

@jeremygaither
Created July 18, 2017 16:47
Show Gist options
  • Save jeremygaither/4be2511fd33c0a98a6ea6104cbc0b6c8 to your computer and use it in GitHub Desktop.
Save jeremygaither/4be2511fd33c0a98a6ea6104cbc0b6c8 to your computer and use it in GitHub Desktop.
# Set-ExecutionPolicy -ExecutionPolicy Bypass -Force
If (-not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator"))
{
Write-Warning "You do not have Administrator rights to run this script!"
exit 1
}
(Test-Path C:\TEMP) -or (New-Item -ItemType directory -Path C:\TEMP)
(Test-Path C:\TEMP\AmazonSSMAgentSetup.exe) -and (Remove-Item C:\TEMP\AmazonSSMAgentSetup.exe)
Invoke-WebRequest -Uri https://s3.amazonaws.com/ec2-downloads-windows/SSMAgent/latest/windows_amd64/AmazonSSMAgentSetup.exe -Outfile C:\temp\AmazonSSMAgentSetup.exe
Start-Process -FilePath C:\temp\AmazonSSMAgentSetup.exe -ArgumentList ALLOWEC2INSTALL=YES, /install, /passive, /norestart, /log, c:\temp\AmazonSSMAgentSetup.log -Wait -NoNewWindow
if ($?) { Write-Output "install ok" }
Restart-Service AmazonSSMAgent
@jeremygaither
Copy link
Author


Set-ExecutionPolicy -ExecutionPolicy Bypass -Force

iwr https://gist.githubusercontent.com/jeremygaither/4be2511fd33c0a98a6ea6104cbc0b6c8/raw/286af707e8e7378a8de3f410cb0e905c46a978b3/Install-AmazonSSMAgent.ps1 | iex

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment