How to add RemoteAddresses to the existing Windows Firewall rule

$newips = @("1.2.3.4/24", "1.2.3.5/24", "1.2.3.6/24")
$ips = (Get-NetFirewallRule -DisplayName "RuleName" | Get-NetFirewallAddressFilter ).RemoteAddress
$add = $ips + $newips
Get-NetFirewallrule -DisplayName 'RuleName'|Set-NetFirewallRule -RemoteAddress $add
2020   firewall   powershell   windows
Popular