Share via


How to Create Windows Firewall Predefined rules using Powershell

Question

Wednesday, August 20, 2014 12:29 AM

Windows Firewall Predefined rules using Powershell

Following commands are working some time however sometimes it's giving errors. Any help would be appreciated

WORKING ==> Set-NetFirewallRule -DisplayGroup "File and Printer Sharing" -Enabled True 

 

Set-NetFirewallRule -DisplayGroup "File and Printer Sharing" -Enabled True -Direction Inbound

NOT WORKING

PS C:\Windows\system32> Set-NetFirewallRule -DisplayGroup "File and Printer Sharing" -Enabled True -Direction Outbound

Set-NetFirewallRule : One of the port keywords is invalid.
At line:1 char:1

  • Set-NetFirewallRule -DisplayGroup "File and Printer Sharing" -Enabled True -Dire ...

    + CategoryInfo          : InvalidArgument: (MSFT_NetFirewal...ystemName = ""):root/standardcimv2/MSFT_NetFirewallRule) [Se 
   t-NetFirewallRule], CimException
    + FullyQualifiedErrorId : HRESULT 0x80070057,Set-NetFirewallRule

PS C:\Windows\system32> Set-NetFirewallRule -DisplayGroup "File and Printer Sharing" -Enabled True -Direction Outbound
Set-NetFirewallRule : One of the port keywords is invalid.
At line:1 char:1

  • Set-NetFirewallRule -DisplayGroup "File and Printer Sharing" -Enabled True -Dire ...

    + CategoryInfo          : InvalidArgument: (MSFT_NetFirewal...ystemName = ""):root/standardcimv2/MSFT_NetFirewallRule) [Se 
   t-NetFirewallRule], CimException
    + FullyQualifiedErrorId : HRESULT 0x80070057,Set-NetFirewallRule

Anoop C Nair (My Blog www.AnoopCNair.com) - Twitter @anoopmannur - FaceBook Forum For SCCM

All replies (17)

Wednesday, August 20, 2014 1:48 AM ✅Answered | 3 votes

The ”File and Printer Sharing” is a group of 16 rules. 14 are outbound, and 2 are inbound. Trying to use the command 

Set-NetFirewallRule -DisplayGroup "File and Printer Sharing" -Enabled True -Direction Outbound

Will error out twice on the 2 inbound rules.

The 2 inbound rules in this group are:

  • File and Printer Sharing (Spooler Service - RPC)
  • File and Printer Sharing (Spooler Service - RPC-EPMAP)

To see further details, type in:

Set-NetFirewallRule -DisplayGroup "File and Printer Sharing" -Enabled True -Direction Outbound -Verbose

To see the 14 outbound rules in this group, type in:

$FPS = Get-NetFirewallRule -DisplayGroup "File and Printer Sharing" -Direction Outbound
$FPS.Count # => 14
$FPS 

The 14 outbound rules in this group are:

File and Printer Sharing (NB-Session-In)
File and Printer Sharing (NB-Session-Out)
File and Printer Sharing (SMB-In)
File and Printer Sharing (SMB-Out)
File and Printer Sharing (NB-Name-In)
File and Printer Sharing (NB-Name-Out)
File and Printer Sharing (NB-Datagram-In)
File and Printer Sharing (NB-Datagram-Out)
File and Printer Sharing (Echo Request - ICMPv4-In)
File and Printer Sharing (Echo Request - ICMPv4-Out)
File and Printer Sharing (Echo Request - ICMPv6-In)
File and Printer Sharing (Echo Request - ICMPv6-Out)
File and Printer Sharing (LLMNR-UDP-In)
File and Printer Sharing (LLMNR-UDP-Out)

To setup the 14 outbound rules in this group, type in:

Get-NetFirewallRule -DisplayGroup "File and Printer Sharing" -Direction Outbound | Set-NetFirewallRule -Enabled True -Direction Outbound 

Hope that helps..

Sam Boutros, Senior Consultant, Software Logic, KOP, PA http://superwidgets.wordpress.com (Please take a moment to Vote as Helpful and/or Mark as Answer, where applicable)


Wednesday, August 20, 2014 8:03 AM ✅Answered | 2 votes

The command:

Get-NetFirewallRule -DisplayGroup "File and Printer Sharing" -Direction Outbound

produces the output:

Name                  : FPS-NB_Session-In-TCP
DisplayName           : File and Printer Sharing (NB-Session-In)
Description           : Inbound rule for File and Printer Sharing to allow NetBIOS Session Service connections. [TCP 139]
DisplayGroup          : File and Printer Sharing
Group                 : @FirewallAPI.dll,-28502
Enabled               : True
Profile               : Any
Platform              : {}
Direction             : Outbound
Action                : Allow
EdgeTraversalPolicy   : Block
LooseSourceMapping    : False
LocalOnlyMapping      : False
Owner                 : 
PrimaryStatus         : OK
Status                : The rule was parsed successfully from the store. (65536)
EnforcementStatus     : NotApplicable
PolicyStoreSource     : PersistentStore
PolicyStoreSourceType : Local

Name                  : FPS-NB_Session-Out-TCP
DisplayName           : File and Printer Sharing (NB-Session-Out)
Description           : Outbound rule for File and Printer Sharing to allow NetBIOS Session Service connections. [TCP 139]
DisplayGroup          : File and Printer Sharing
Group                 : @FirewallAPI.dll,-28502
Enabled               : True
Profile               : Any
Platform              : {}
Direction             : Outbound
Action                : Allow
EdgeTraversalPolicy   : Block
LooseSourceMapping    : False
LocalOnlyMapping      : False
Owner                 : 
PrimaryStatus         : OK
Status                : The rule was parsed successfully from the store. (65536)
EnforcementStatus     : NotApplicable
PolicyStoreSource     : PersistentStore
PolicyStoreSourceType : Local

Name                  : FPS-SMB-In-TCP
DisplayName           : File and Printer Sharing (SMB-In)
Description           : Inbound rule for File and Printer Sharing to allow Server Message Block transmission and reception via Named Pipes. [TCP 445]
DisplayGroup          : File and Printer Sharing
Group                 : @FirewallAPI.dll,-28502
Enabled               : True
Profile               : Any
Platform              : {}
Direction             : Outbound
Action                : Allow
EdgeTraversalPolicy   : Block
LooseSourceMapping    : False
LocalOnlyMapping      : False
Owner                 : 
PrimaryStatus         : OK
Status                : The rule was parsed successfully from the store. (65536)
EnforcementStatus     : NotApplicable
PolicyStoreSource     : PersistentStore
PolicyStoreSourceType : Local

Name                  : FPS-SMB-Out-TCP
DisplayName           : File and Printer Sharing (SMB-Out)
Description           : Outbound rule for File and Printer Sharing to allow Server Message Block transmission and reception via Named Pipes. [TCP 445]
DisplayGroup          : File and Printer Sharing
Group                 : @FirewallAPI.dll,-28502
Enabled               : True
Profile               : Any
Platform              : {}
Direction             : Outbound
Action                : Allow
EdgeTraversalPolicy   : Block
LooseSourceMapping    : False
LocalOnlyMapping      : False
Owner                 : 
PrimaryStatus         : OK
Status                : The rule was parsed successfully from the store. (65536)
EnforcementStatus     : NotApplicable
PolicyStoreSource     : PersistentStore
PolicyStoreSourceType : Local

Name                  : FPS-NB_Name-In-UDP
DisplayName           : File and Printer Sharing (NB-Name-In)
Description           : Inbound rule for File and Printer Sharing to allow NetBIOS Name Resolution. [UDP 137]
DisplayGroup          : File and Printer Sharing
Group                 : @FirewallAPI.dll,-28502
Enabled               : True
Profile               : Any
Platform              : {}
Direction             : Outbound
Action                : Allow
EdgeTraversalPolicy   : Block
LooseSourceMapping    : False
LocalOnlyMapping      : False
Owner                 : 
PrimaryStatus         : OK
Status                : The rule was parsed successfully from the store. (65536)
EnforcementStatus     : NotApplicable
PolicyStoreSource     : PersistentStore
PolicyStoreSourceType : Local

Name                  : FPS-NB_Name-Out-UDP
DisplayName           : File and Printer Sharing (NB-Name-Out)
Description           : Outbound rule for File and Printer Sharing to allow NetBIOS Name Resolution. [UDP 137]
DisplayGroup          : File and Printer Sharing
Group                 : @FirewallAPI.dll,-28502
Enabled               : True
Profile               : Any
Platform              : {}
Direction             : Outbound
Action                : Allow
EdgeTraversalPolicy   : Block
LooseSourceMapping    : False
LocalOnlyMapping      : False
Owner                 : 
PrimaryStatus         : OK
Status                : The rule was parsed successfully from the store. (65536)
EnforcementStatus     : NotApplicable
PolicyStoreSource     : PersistentStore
PolicyStoreSourceType : Local

Name                  : FPS-NB_Datagram-In-UDP
DisplayName           : File and Printer Sharing (NB-Datagram-In)
Description           : Inbound rule for File and Printer Sharing to allow NetBIOS Datagram transmission and reception. [UDP 138]
DisplayGroup          : File and Printer Sharing
Group                 : @FirewallAPI.dll,-28502
Enabled               : True
Profile               : Any
Platform              : {}
Direction             : Outbound
Action                : Allow
EdgeTraversalPolicy   : Block
LooseSourceMapping    : False
LocalOnlyMapping      : False
Owner                 : 
PrimaryStatus         : OK
Status                : The rule was parsed successfully from the store. (65536)
EnforcementStatus     : NotApplicable
PolicyStoreSource     : PersistentStore
PolicyStoreSourceType : Local

Name                  : FPS-NB_Datagram-Out-UDP
DisplayName           : File and Printer Sharing (NB-Datagram-Out)
Description           : Outbound rule for File and Printer Sharing to allow NetBIOS Datagram transmission and reception. [UDP 138]
DisplayGroup          : File and Printer Sharing
Group                 : @FirewallAPI.dll,-28502
Enabled               : True
Profile               : Any
Platform              : {}
Direction             : Outbound
Action                : Allow
EdgeTraversalPolicy   : Block
LooseSourceMapping    : False
LocalOnlyMapping      : False
Owner                 : 
PrimaryStatus         : OK
Status                : The rule was parsed successfully from the store. (65536)
EnforcementStatus     : NotApplicable
PolicyStoreSource     : PersistentStore
PolicyStoreSourceType : Local

Name                  : FPS-ICMP4-ERQ-In
DisplayName           : File and Printer Sharing (Echo Request - ICMPv4-In)
Description           : Echo Request messages are sent as ping requests to other nodes.
DisplayGroup          : File and Printer Sharing
Group                 : @FirewallAPI.dll,-28502
Enabled               : True
Profile               : Any
Platform              : {}
Direction             : Outbound
Action                : Allow
EdgeTraversalPolicy   : Block
LooseSourceMapping    : False
LocalOnlyMapping      : False
Owner                 : 
PrimaryStatus         : OK
Status                : The rule was parsed successfully from the store. (65536)
EnforcementStatus     : NotApplicable
PolicyStoreSource     : PersistentStore
PolicyStoreSourceType : Local

Name                  : FPS-ICMP4-ERQ-Out
DisplayName           : File and Printer Sharing (Echo Request - ICMPv4-Out)
Description           : Echo Request messages are sent as ping requests to other nodes.
DisplayGroup          : File and Printer Sharing
Group                 : @FirewallAPI.dll,-28502
Enabled               : True
Profile               : Any
Platform              : {}
Direction             : Outbound
Action                : Allow
EdgeTraversalPolicy   : Block
LooseSourceMapping    : False
LocalOnlyMapping      : False
Owner                 : 
PrimaryStatus         : OK
Status                : The rule was parsed successfully from the store. (65536)
EnforcementStatus     : NotApplicable
PolicyStoreSource     : PersistentStore
PolicyStoreSourceType : Local

Name                  : FPS-ICMP6-ERQ-In
DisplayName           : File and Printer Sharing (Echo Request - ICMPv6-In)
Description           : Echo Request messages are sent as ping requests to other nodes.
DisplayGroup          : File and Printer Sharing
Group                 : @FirewallAPI.dll,-28502
Enabled               : True
Profile               : Any
Platform              : {}
Direction             : Outbound
Action                : Allow
EdgeTraversalPolicy   : Block
LooseSourceMapping    : False
LocalOnlyMapping      : False
Owner                 : 
PrimaryStatus         : OK
Status                : The rule was parsed successfully from the store. (65536)
EnforcementStatus     : NotApplicable
PolicyStoreSource     : PersistentStore
PolicyStoreSourceType : Local

Name                  : FPS-ICMP6-ERQ-Out
DisplayName           : File and Printer Sharing (Echo Request - ICMPv6-Out)
Description           : Echo Request messages are sent as ping requests to other nodes.
DisplayGroup          : File and Printer Sharing
Group                 : @FirewallAPI.dll,-28502
Enabled               : True
Profile               : Any
Platform              : {}
Direction             : Outbound
Action                : Allow
EdgeTraversalPolicy   : Block
LooseSourceMapping    : False
LocalOnlyMapping      : False
Owner                 : 
PrimaryStatus         : OK
Status                : The rule was parsed successfully from the store. (65536)
EnforcementStatus     : NotApplicable
PolicyStoreSource     : PersistentStore
PolicyStoreSourceType : Local

Name                  : FPS-LLMNR-In-UDP
DisplayName           : File and Printer Sharing (LLMNR-UDP-In)
Description           : Inbound rule for File and Printer Sharing to allow Link Local Multicast Name Resolution. [UDP 5355]
DisplayGroup          : File and Printer Sharing
Group                 : @FirewallAPI.dll,-28502
Enabled               : True
Profile               : Any
Platform              : {}
Direction             : Outbound
Action                : Allow
EdgeTraversalPolicy   : Block
LooseSourceMapping    : False
LocalOnlyMapping      : False
Owner                 : 
PrimaryStatus         : OK
Status                : The rule was parsed successfully from the store. (65536)
EnforcementStatus     : NotApplicable
PolicyStoreSource     : PersistentStore
PolicyStoreSourceType : Local

Name                  : FPS-LLMNR-Out-UDP
DisplayName           : File and Printer Sharing (LLMNR-UDP-Out)
Description           : Outbound rule for File and Printer Sharing to allow Link Local Multicast Name Resolution. [UDP 5355]
DisplayGroup          : File and Printer Sharing
Group                 : @FirewallAPI.dll,-28502
Enabled               : True
Profile               : Any
Platform              : {}
Direction             : Outbound
Action                : Allow
EdgeTraversalPolicy   : Block
LooseSourceMapping    : False
LocalOnlyMapping      : False
Owner                 : 
PrimaryStatus         : OK
Status                : The rule was parsed successfully from the store. (65536)
EnforcementStatus     : NotApplicable
PolicyStoreSource     : PersistentStore
PolicyStoreSourceType : Local

The command:

(Get-NetFirewallRule -DisplayGroup "File and Printer Sharing" -Direction Outbound).DisplayName

shows the display names of the 14 outbound rules in the FPS group:

File and Printer Sharing (NB-Session-In)
File and Printer Sharing (NB-Session-Out)
File and Printer Sharing (SMB-In)
File and Printer Sharing (SMB-Out)
File and Printer Sharing (NB-Name-In)
File and Printer Sharing (NB-Name-Out)
File and Printer Sharing (NB-Datagram-In)
File and Printer Sharing (NB-Datagram-Out)
File and Printer Sharing (Echo Request - ICMPv4-In)
File and Printer Sharing (Echo Request - ICMPv4-Out)
File and Printer Sharing (Echo Request - ICMPv6-In)
File and Printer Sharing (Echo Request - ICMPv6-Out)
File and Printer Sharing (LLMNR-UDP-In)
File and Printer Sharing (LLMNR-UDP-Out)

If your output is different than this, it means rules have been removed (or added) to the File and Print Sharing group.

For example, if you run the command:

New-NetFirewallRule -DisplayName "My test rule 2" -group "File and Printer Sharing" -Enabled True -Protocol tcp -LocalPort 12346 -Direction Inbound

This adds a new inbound firewall rule to the FPS group. Output looks like:

Name                  : {06449724-944b-4048-834f-8870b9dce4f6}
DisplayName           : My test rule 2
Description           : 
DisplayGroup          : File and Printer Sharing
Group                 : File and Printer Sharing
Enabled               : True
Profile               : Any
Platform              : {}
Direction             : Inbound
Action                : Allow
EdgeTraversalPolicy   : Block
LooseSourceMapping    : False
LocalOnlyMapping      : False
Owner                 : 
PrimaryStatus         : OK
Status                : The rule was parsed successfully from the store. (65536)
EnforcementStatus     : NotApplicable
PolicyStoreSource     : PersistentStore
PolicyStoreSourceType : Local

This test rule is of course useless because there's no listener on TCP port 12346 on this particular machine..

The new rule can also be viewed in Windows Firewall with Advanced Security:

Now if you run the command:

(Get-NetFirewallRule -DisplayGroup "File and Printer Sharing" -Direction Inbound).DisplayName

the output will look like:

File and Printer Sharing (Spooler Service - RPC)
File and Printer Sharing (Spooler Service - RPC-EPMAP)
My test rule 2

Sam Boutros, Senior Consultant, Software Logic, KOP, PA http://superwidgets.wordpress.com (Please take a moment to Vote as Helpful and/or Mark as Answer, where applicable)


Wednesday, August 20, 2014 9:53 AM ✅Answered | 1 vote

Yes. I tried that as well with no success. I don't think we can define predefined rules with that command. However, we don't have displaygroup option.

Regards

Anoop

Anoop C Nair (My Blog www.AnoopCNair.com) - Twitter @anoopmannur - FaceBook Forum For SCCM

Please refer to the New-NetFirewallRule cmdlet documentation

Type in

help New-NetFirewallRule -full

or see this link

The DisplayGroup property can be set/modified via the -Group parameter as illustrated in New-NetFirewallRule example I posted in this thread.

I suggest you spend some time reading the documentation first.

Sam Boutros, Senior Consultant, Software Logic, KOP, PA http://superwidgets.wordpress.com (Please take a moment to Vote as Helpful and/or Mark as Answer, where applicable)


Wednesday, August 20, 2014 12:47 AM | 1 vote

try

netsh advfirewall firewall set rule group=”File and Printer Sharing” new enable=Yes

Also part of this script

Sam Boutros, Senior Consultant, Software Logic, KOP, PA http://superwidgets.wordpress.com (Please take a moment to Vote as Helpful and/or Mark as Answer, where applicable)


Wednesday, August 20, 2014 1:08 AM

Thank you. But I would like to use powershell.

Anoop C Nair (My Blog www.AnoopCNair.com) - Twitter @anoopmannur - FaceBook Forum For SCCM


Wednesday, August 20, 2014 6:48 AM

Thank you Sam ! 

I'm able to set 14 outbound rules using the command mentioned in the bottom of your reply. However the command you've provided for listing down the 14 outbound rules is not working. It gives me following result and that is not the expected one ;)

PS C:\Windows\system32> $FPS = Get-NetFirewallRule -DisplayGroup "File and Printer Sharing" -Direction Outbound
$FPS.Count # = > 14
$FPS 


Name                  : FPS-SMB-Out-TCP-NoScope
DisplayName           : File and Printer Sharing (SMB-Out)
Description           : Outbound rule for File and Printer Sharing to allow Server Message Block transmission and reception via Named Pipes. 
                        [TCP 445]
DisplayGroup          : File and Printer Sharing
Group                 : @FirewallAPI.dll,-28502
Enabled               : True
Profile               : Domain
Platform              : {}
Direction             : Outbound
Action                : Allow
EdgeTraversalPolicy   : Block
LooseSourceMapping    : False
LocalOnlyMapping      : False
Owner                 : 
PrimaryStatus         : OK
Status                : The rule was parsed successfully from the store. (65536)
EnforcementStatus     : NotApplicable
PolicyStoreSource     : PersistentStore
PolicyStoreSourceType : Local

Anoop C Nair (My Blog www.AnoopCNair.com) - Twitter @anoopmannur - FaceBook Forum For SCCM


Wednesday, August 20, 2014 8:39 AM

Thank you much Sam for all detailed explanations

Thank you much for the help Sam !

1) File and Printer Sharing Outbound Rules

PS C:\Windows\system32> (Get-NetFirewallRule -DisplayGroup "File and Printer Sharing" -Direction Outbound).DisplayName

File and Printer Sharing (LLMNR-UDP-Out)
File and Printer Sharing (Echo Request - ICMPv6-Out)
File and Printer Sharing (Echo Request - ICMPv4-Out)
File and Printer Sharing (NB-Datagram-Out)
File and Printer Sharing (NB-Name-Out)
File and Printer Sharing (SMB-Out)
File and Printer Sharing (NB-Session-Out)
File and Printer Sharing (Echo Request - ICMPv6-Out)
File and Printer Sharing (Echo Request - ICMPv4-Out)
File and Printer Sharing (NB-Datagram-Out)
File and Printer Sharing (NB-Name-Out)
File and Printer Sharing (SMB-Out)
File and Printer Sharing (NB-Session-Out)

2) File and Printer Sharing Outbound Rules :

PS C:\Windows\system32> (Get-NetFirewallRule -DisplayGroup "File and Printer Sharing" -Direction Inbound).DisplayName

File and Printer Sharing (LLMNR-UDP-In)
File and Printer Sharing (Echo Request - ICMPv6-In)
File and Printer Sharing (Echo Request - ICMPv4-In)
File and Printer Sharing (Spooler Service - RPC-EPMAP)
File and Printer Sharing (Spooler Service - RPC)
File and Printer Sharing (NB-Datagram-In)
File and Printer Sharing (NB-Name-In)
File and Printer Sharing (SMB-In)
File and Printer Sharing (NB-Session-In)
File and Printer Sharing (Echo Request - ICMPv6-In)
File and Printer Sharing (Echo Request - ICMPv4-In)
File and Printer Sharing (Spooler Service - RPC-EPMAP)
File and Printer Sharing (Spooler Service - RPC)
File and Printer Sharing (NB-Datagram-In)
File and Printer Sharing (NB-Name-In)
File and Printer Sharing (SMB-In)
File and Printer Sharing (NB-Session-In)

3) The following command which you provided is working fine for me when there are some rule (at least one rule which is part of File and Printer Sharing group) related to File and Print Sharing in Windows Firewall Console. However, when we remove all the rule related to WF console then same command is giving errors :(

Any idea ?

PS C:\Windows\system32> Get-NetFirewallRule -DisplayGroup "File and Printer Sharing" -Direction Outbound | Set-NetFirewallRule -Enabled True -Direction Outbound

Get-NetFirewallRule : No matching MSFT_NetFirewallRule objects found by CIM query for instances of the root/standardcimv2/MSFT_NetFirewallRule 
class on the  CIM server: SELECT * FROM MSFT_NetFirewallRule  WHERE ((DisplayGroup LIKE 'File and Printer Sharing')) AND ((Direction = 2)). 
Verify query parameters and retry.
At line:1 char:1

  • Get-NetFirewallRule -DisplayGroup "File and Printer Sharing" -Direction Outbound ...

    + CategoryInfo          : ObjectNotFound: (MSFT_NetFirewallRule:String) [Get-NetFirewallRule], CimJobException
    + FullyQualifiedErrorId : CmdletizationQuery_NotFound,Get-NetFirewallRule

Anoop C Nair (My Blog www.AnoopCNair.com) - Twitter @anoopmannur - FaceBook Forum For SCCM


Wednesday, August 20, 2014 8:44 AM | 1 vote

yes, this is by design. It's not an error. It's an accurate message. If you don't like to see the message add 

 -ErrorAction SilentlyContinue

at the end of the command

Sam Boutros, Senior Consultant, Software Logic, KOP, PA http://superwidgets.wordpress.com (Please take a moment to Vote as Helpful and/or Mark as Answer, where applicable)


Wednesday, August 20, 2014 8:49 AM

More details about the point 3 which I mentioned in the above reply

Also, I've noticed that after the error it's not creating any firewall rules :(

The command works fine if the any one of these outbound rules are in place.

The command doesn't work if none of the rules from File and Printer sharing group is already present in console as shown in the following pic

Anoop C Nair (My Blog www.AnoopCNair.com) - Twitter @anoopmannur - FaceBook Forum For SCCM


Wednesday, August 20, 2014 8:55 AM

The command Get-NetFirewallRule works as designed. If it returns the message "No matching MSFT_NetFirewallRule objects found ", that does not mean it "does not work". That means what it actually says: "no matching objects found". Again, this behavior is by design.

Sam Boutros, Senior Consultant, Software Logic, KOP, PA http://superwidgets.wordpress.com (Please take a moment to Vote as Helpful and/or Mark as Answer, where applicable)


Wednesday, August 20, 2014 9:32 AM

Thank you Sam. But the fact is that the command is not able to create any rules File and Printer Sharing group. Any idea

Anoop C Nair (My Blog www.AnoopCNair.com) - Twitter @anoopmannur - FaceBook Forum For SCCM


Wednesday, August 20, 2014 9:35 AM | 2 votes

The Get-NetFirewallRule cmdlet is not designed to create firewalls rules. Use the New-NetFirewallRule cmdlet for that.

Sam Boutros, Senior Consultant, Software Logic, KOP, PA http://superwidgets.wordpress.com (Please take a moment to Vote as Helpful and/or Mark as Answer, where applicable)


Wednesday, August 20, 2014 9:47 AM

Yes. I tried that as well with no success. I don't think we can define predefined rules with that command. However, we don't have displaygroup option.

Regards

Anoop

Anoop C Nair (My Blog www.AnoopCNair.com) - Twitter @anoopmannur - FaceBook Forum For SCCM


Wednesday, August 20, 2014 10:51 AM

I'll mark this as answered but in fact when we use -GROUP parameter with New-NetFirewallRule command is not power full to get predefined Firewall rules.

I'll check and read more as you suggested.

Thank you much Sam !!!

Anoop C Nair (My Blog www.AnoopCNair.com) - Twitter @anoopmannur - FaceBook Forum For SCCM


Wednesday, August 20, 2014 1:13 PM

After reading bit more on the topic I came to know the difference between both the commands.

Set-NetFirewallRule can be used to enable the existing rules.

New-NetFirewallRule can be used to create new rules 

Sorry for the confusion :(

Anoop C Nair (My Blog www.AnoopCNair.com) - Twitter @anoopmannur - FaceBook Forum For SCCM


Wednesday, September 17, 2014 8:55 PM

Hi Guys,

i have same issue . There are certain predefined rules from group ("Distributed Transaction Coordinator") that i need to add. I cannot use Set-NetFirewallRule because it does not exsist. 

Where as when i use New-NetFirewallRule, it creates a new rule and assigns that group. if i use this approach i need to specify all the properties which i dont want to.

what i want is to add the predefined rules from group  ("Distributed Transaction Coordinator") . 

I do not see any answers posted here


Thursday, September 18, 2014 12:57 AM | 1 vote

This is what I end up with

http://anoopcnair.com/2014/08/21/create-windows-firewall-outbound-rules-powershell-sccm-configmgr-2012-client/

Anoop C Nair (My Blog www.AnoopCNair.com) - Twitter @anoopmannur - FaceBook Forum For SCCM