Created
November 9, 2023 07:18
-
-
Save makeitcloudy/9bed7d905e6b6d43ff67c719431dec8c 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
#Does anybody know a way to add an Inbound Firewall Rule to a GPO using PowerShell? | |
#Below is example for WinRM inbound rule | |
$domain = "abc.com\" | |
$GpoName = "Global-WinRM" | |
$PolicyStoreName = $domain + $GpoName | |
$GpoSessionName = Open-NetGPO –PolicyStore $PolicyStoreName | |
New-NetFirewallRule -Name "Windows Management I" ` | |
-DisplayName "Windows Management Instrumentation (ASync-In)" ` | |
-Group "@FirewallAPI.dll,-34251" ` | |
-Program "%systemroot%\system32\wbem\unsecapp.exe" ` | |
-Profile Domain ` | |
-Action Allow ` | |
-GPOSession $GpoSessionName ` | |
-Verbose | |
Save-NetGPO -GPOSession $GpoSessionName |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment