I am trying to create a new ESXi host firewall rule and am trying to define a VcHostFirewallRuleDirection object by using the following:
var firewallRuleDirection = new VcHostFirewallRuleDirection();
I receive the following error:
Unable to create object : VcHostFirewallRuleDirection : com.vmware.vim.binding.vim.host.Ruleset$Rule$Direction
Seems pretty simple, but it's def. not correct for some reason. What would be the correct syntax to create this?
VcHostFirewallRuleDirection is not a normal scripting object but an enumeration, so you should not try to initialize it using new, but instead directly access the enumeration value(s).
Something like the following should work:
var firewallRuleDirectionInbound = VcHostFirewallRuleDirection.inbound;
var firewallRuleDirectionOutbound = VcHostFirewallRuleDirection.outbound;
I have to create a bunch of rules for the ESXi hosts. Could not see any examples. Could you give some examples here on how to create new rules? I am able to see the list of rules those are present but not sure how to create new ones and apply them. Here some example rules I am looking to create
Allow - SSH Server - <IPs, and Network Addresses>
Deny - SSH client - <Any>