question

Nkei-1824 avatar image
0 Votes"
Nkei-1824 asked Nkei-1824 commented

Net-NewFirewallFule from NetSecurity module fails to add rule to Local GPO store policy

By default, Windows has at least 2 Firewall rules sources: weird local and local group policy. In netsh you can easily switch between them:

 netsh advfirewall set store gpo=COMUTERNAME
 netsh advfirewall set store local

Any requests to commands *-NewFirewallFule will operate on Local source. I found information that in order to add to Local Group Policy Source you need to specify localhost as a store:

New-NetFirewallRule -Name Blah -PolicyStore localhost

The issue is that while I can easily add any rule via netsh to Local GPO (or do it via MMC's module Local Security Settings), an attempt to use -PolicyStore localhost results in:

Get-NetFirewallRule: The network path was not found.

What could be the issue? This is purely home user client machine, no AD used.

windows-server-powershellwindows-10-network
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

IanXue-MSFT avatar image
0 Votes"
IanXue-MSFT answered Nkei-1824 commented

Hi,

According to the help file of the Get-NetFirewallRule, the local GPOs can be specified with the hostname. Please see if the command works with the hostname.

Get-NetFirewallRule -PolicyStore $hostname -Name $name

https://docs.microsoft.com/en-us/powershell/module/netsecurity/get-netfirewallrule

Best Regards,
Ian Xue
============================================
If the Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

No, using hostname/computername/localhost results in the same issue.

0 Votes 0 ·