Last active
February 13, 2021 23:13
-
-
Save karimelmel/849e43e93aa015f0e57069ed3d7458c7 to your computer and use it in GitHub Desktop.
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
$blockPrincipal = New-Object -TypeName System.Security.Principal.NTAccount ("Everyone") | |
$BlockPrincipalSID = $blockPrincipal.Translate([System.Security.Principal.SecurityIdentifier]).Value | |
$exceptionPrincipal = New-Object -TypeName System.Security.Principal.NTAccount ("Administrators") | |
$ExceptionPrincipalSID = $exceptionPrincipal.Translate([System.Security.Principal.SecurityIdentifier]).Value | |
$PrincipalSDDL = "O:LSD:(D;;CC;;;$ExceptionPrincipalSID)(A;;CC;;;$BlockPrincipalSID)" | |
New-NetFirewallRule -DisplayName "Block metatdata service for $($blockPrincipal.Value), exception: $($exceptionPrincipal.Value)" ` | |
-Action Block ` | |
-Direction Outbound ` | |
-Protocol TCP ` | |
-RemoteAddress 169.254.169.254 ` | |
-LocalUser $PrincipalSDDL |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment