Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 49146

VMware host firewall rulesetid that contains a space.

$
0
0

Another question on running a PowerCLI script to change the firewall settings on a VMware Host.

When I run the script below and the "rulesetid" does not contain any spaces, it runs just fine.

However, if the rulesetid has a space I get the following error message:

Message: EsxCLI.CLIFault.summary;
InnerText: Invalid Ruleset Id.EsxCLI.CLIFault.summary
At line:1 char:1
+ $ESXcli.network.firewall.ruleset.set.Invoke($arguments1)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (:) [], MethodFault
    + FullyQualifiedErrorId : VMware.VimAutomation.Sdk.Types.V1.ErrorHandling.VimException.MethodFault

The output for the hash table is:

Name                           Value
----                           -----    
allowedall        False 
rulsetid                       SSH Client

I have also set the $Security.Name variable in quotes ($Security.'Name' and $Security."Name") which resulted in the rulesetid to be in quotes ("SSH Client).

foreach ($Security in $SecurityProfile1) {

    $arguments1 = @{"rulesetid"= $Security.Name
                    "allowedall" = $Security.Allowed}    

$ESXcli.network.firewall.ruleset.set.Invoke($arguments1)
$ESXcli.network.firewall.ruleset.allowedip.add.Invoke($arguments2)
}

Any suggestions, etc. would be greatly appreciated.

Thanks.


Viewing all articles
Browse latest Browse all 49146

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>