Doing something similar to this post.... PowerCLI Script for Firewall allowed IP's
I am trying to add a list of IP's to the vsphere client firewall service.
Here's what i have:
$cluster = mycluster
$ip1 = "1.2.3.4/24"
$ip2 = "5.6.7.8/24"
foreach($esx in (Get-Cluster -Name $cluster | Get-VMHost)){
$esxcli = Get-EsxCli -VMHost $esx
$esxcli.network.firewall.ruleset.set($false, $true, "vSphereClient")
$esxcli.network.firewall.ruleset.allowedip.add("$ip1", "vSphereClient")
$esxcli.network.firewall.ruleset.allowedip.add("$ip1", "vSphereClient")
$esxcli.network.firewall.refresh() }
When i flip the $false and $true like it has in the linked post, i get errors saying it is already set to 'all'. When i leave it the way I have it above, it "half-works" and changes the setting to "Only allow connections from the following networks:" like it should.... but it never inputs the ip addresses.... therefore, vsphere loses connection to the host, yada yada....
Thanks for your time.