Skip to content

Instantly share code, notes, and snippets.

@ciphertxt
Created February 4, 2015 00:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ciphertxt/67bf0d2cf5192da88762 to your computer and use it in GitHub Desktop.
Save ciphertxt/67bf0d2cf5192da88762 to your computer and use it in GitHub Desktop.
Get's the latest Windows Server image for EC2 provisioning
Import-Module AWSPowerShell
Function Get-EC2LatestWindowsServerAMI
{
return Get-EC2Image | ? { $_.Platform -eq "Windows" -and $_.ImageOwnerAlias -eq "amazon" -and $_.Name -like "*Windows*Server*2012*R2*English*Base*" } | Sort-Object -Property CreationDate -Descending | Select-Object -First 1
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment