View subnet
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
DMZSubnetA: | |
Type: AWS::EC2::Subnet | |
Properties: | |
AvailabilityZone: !Select ['0', !GetAZs {Ref: 'AWS::Region'}] | |
VpcId: !Ref 'EnvironmentVpc' | |
MapPublicIpOnLaunch: Yes | |
CidrBlock: !Ref 'DMZSubnetCidrA' | |
Tags: | |
- Key: Name | |
Value: !Sub "${EnvironmentValue}-dmzsubnet-a" |
View FixDumbTagMistake.ps1
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
# Change up $role / $product as needed | |
$MajorEnv = 'int' | |
$EnvNumber = '01' | |
$Env = "$MajorEnv$EnvNumber" | |
$Role = 'es-master' | |
$values = "$Env-$Role*" | |
$Product = 'los' | |
# Get empty web server tags |
View GetAutomationRuns.ps1
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
# Find automation runs that have happened in the last 24 hours and the instances that they have run against | |
$Instances = (Get-SSMAutomationExecutionList | where-object { $_.DocumentName -like '*ssm-nightlyrecycle-doc*' -and $_.ExecutionStartTime -gt (Get-Date).AddHours(-24) } | Get-SSMAutomationExecution).Parameters | |
$InstanceIDs = ((Get-SSMAutomationExecutionList | where-object { $_.DocumentName -like '*ssm-nightlyrecycle-doc*' -and $_.ExecutionStartTime -gt (Get-Date).AddHours(-24) } | Get-SSMAutomationExecution).Parameters).Values | |
$Instances = ($InstanceIDs | Get-EC2Instance | Select-object -ExpandProperty Instances) | |
(($Instances.tag) | Where-Object Key -eq "Name").value |
View Run-SSMCommand.ps1
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
$NameWildcard = 'prd01worker*' | |
$Comment = 'Doing stuff' | |
$Commands = @( | |
'dir c:\users', | |
'dir c:\' | |
) | |
# Instance state code 16 is for powered on instances | |
$Instances = (Get-EC2Instance -Filter @( @{name='tag:Name'; values=$NameWildcard}; @{name='instance-state-code'; values = 16} ) | Select-Object -ExpandProperty instances).InstanceId |
View WindowsUpdateAudit.ps1
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
# For auditing when updates were installed, useful for SOC 2 | |
$Session = New-Object -ComObject "Microsoft.Update.Session" | |
$Searcher = $Session.CreateUpdateSearcher() | |
$historyCount = $Searcher.GetTotalHistoryCount() | |
$Searcher.QueryHistory(0, $historyCount) | Select-Object Title, Description, Date, | |
@{name="Operation"; expression={switch($_.operation) { |
View boxstarter.txt
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
# Invoke using following syntax into IE: | |
# http://boxstarter.org/package/url?[raw link to this gist] | |
# Boxstarter options | |
$Boxstarter.RebootOk=$true | |
$Boxstarter.NoPassword=$false # Is this a machine with no logon password? | |
$Boxstarter.AutoLogin=$true | |
Set-WindowsExplorerOptions -EnableShowFileExtensions | |
Disable-UAC |