Commissario
Hi folks,
I have a firewall rule set in Windows Firewall to block some external IPs and I'd like to add a number of ranges.
I'm using the script as described here.
I wanted to run it on a few IPs first, just to make sure it works before I add loads.
My test.csv file looks like this:
However, when I run the script, it appears to run and finishes with no errors but nothing has been added to the rule. At least, when I check the Scope, nothing has been added.
If I try running the set-netfirewallrule command by itself just to add a single IP, the same happens. It appears to run but nothing is added. I am running Powershell as an administrator.
Running Windows 10. Can anyone suggest what might be wrong please? This looks pretty straightforward but I can't see why it's failing.
Thanks.
I have a firewall rule set in Windows Firewall to block some external IPs and I'd like to add a number of ranges.
I'm using the script as described here.
Code:
$csv = Import-Csv -Path 'C:\Scripts\test.csv'
$data = @()
$csv | ForEach-Object { $data += $_.From + "-" + $_.To }
Set-NetFirewallRule -Name "{6929A9BF-26E7-47D9-BF8B-4602AFE7F489}" -RemoteAddress $data
I wanted to run it on a few IPs first, just to make sure it works before I add loads.
My test.csv file looks like this:
Code:
From,To
1.0.1.0,1.0.1.255
1.0.2.0,1.0.3.255
1.0.8.0,1.0.15.255
1.0.16.0,1.0.31.255
However, when I run the script, it appears to run and finishes with no errors but nothing has been added to the rule. At least, when I check the Scope, nothing has been added.
If I try running the set-netfirewallrule command by itself just to add a single IP, the same happens. It appears to run but nothing is added. I am running Powershell as an administrator.
Running Windows 10. Can anyone suggest what might be wrong please? This looks pretty straightforward but I can't see why it's failing.
Thanks.