I have the following script that works when connecting directly to an esxi host...need to modify this so I can attach to the vcenter so I can only run it once as opposed to on each host.
Basically I am trying to add a single IP address to one of the rulesets on all the hosts.
(Get-VMHost $esxhost )
$esxcli = Get-EsxCli -VMHost $esxhost
This is probably simple, but when I try a FOREACH statement it just doesn't work. Not very proficient with powercli
Any help would be appreciated!
To run the script on all of the hosts, you can use the following command:
(Get-VMHost | Get-EsxCli).network.firewall.ruleset.allowedip.add("10.10.10.10", "vSphereClient")