CMD for firewall rules
I would like to use cmd or ps to accomplish the folllowing:
Go to Computer Configuration > Policies > Windows Settings > Security Settings > Windows Firewall with Advanced Security > Windows Firewall with Advanced Security – LDAP > Inbound Rules.
Right-click and choose New Rule.
Choose Custom and click Next.
Choose All programs and click Next.
Select TCP as the Protocol type..
Select RPC Dynamic Ports as the Local Port and click Next.
Specify the IP address of the scan node on the remote IP addresses list or choose Any IP address and then click Next.
Select Allow the connection and click Next.
Select the checkboxes that fulfill the machine connection conditions and click Next.
Specify Radar RPC Dynamic Ports as the name and click Finish.
I have tried the following command but it does not tick the box under the “Programs and Services” tab for “All programs that meet the specified conditions” which is what makes it work:
netsh advfirewall firewall add rule name=RPCTraffic dir=in action=allow protocol=TCP localport=RPC Dynamic Ports enable=yes remoteip=LocalSubnet profile=domain