Created
November 19, 2014 01:43
-
-
Save ProTip/c80b1a3a29e488a6dd6d to your computer and use it in GitHub Desktop.
This file contains hidden or 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
cmd = powershell_out("Get-NetFirewallRule -DisplayName 'Block AWS Metadata'") | |
case cmd.exitstatus | |
when 1 | |
powershell_out!("New-NetFirewallRule -DisplayName 'Block AWS Metadata' -Action Block -Direction 'outbound' -RemoteAddress '169.254.169.254' -RemotePort '80' -Protocol 'tcp' | Get-NetFirewallSecurityFilter | Set-NetFirewallSecurityFilter -LocalUser 'O:LSD:(D;;CC;;;SY)(D;;CC;;;LA)'") | |
when 0 | |
powershell_out!("Set-NetFirewallRule -DisplayName 'Block AWS Metadata' -Action Block -Direction 'outbound' -RemoteAddress '169.254.169.254' -RemotePort '80' -Protocol 'tcp' ") | |
powershell_out!("Get-NetFirewallRule -DisplayName 'Block AWS Metadata' | Get-NetFirewallSecurityFilter | Set-NetFirewallSecurityFilter -LocalUser 'O:LSD:(D;;CC;;;SY)(D;;CC;;;LA)' ") | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment