VMware Cloud Community
sanderha
Contributor
Contributor
Jump to solution

Get-esxcli Invoke() two parameters?

Hi, i am pretty new with powerCLI in general and was wondering about this.

I am trying to change LLDP settings on multiple hosts in our VMware Cluster, this is the result:

Get-cluster -name "VMCluster" | get-vmhost |`

   %{ Write-Host $_.Name ; `

   (Get-Esxcli -v2 -VMHost $_).system.module.parameters.set.invoke(@{module="i40en"}).invoke(@{parameterstring="LLDP=0,0,0,0,0,0,0,0"})}

No value is specified for the mandatory parameter 'parameterstring'.

At line:3 char:4

+    (Get-Esxcli -v2 -VMHost $_).system.module.parameters.set.invoke(@{ ...

+    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : OperationStopped: (:) [], InvalidArgument

    + FullyQualifiedErrorId : VMware.VimAutomation.ViCore.Types.V1.ErrorHandling.InvalidArgument

It seems like it doesn't like the second ".invoke" i am trying to do, not recognizing the parameterstring (-p) paramater, does anyone have a clue how to get this working?

1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

When you use the V2 version of Get-EsxCli you have to provide all the parameters in a hash table.

See PowerCLI 6.3 R1: Get-ESXCLI Why the V2? for the details.

Get-cluster -name "VMCluster" |

%{

    Write-Host $_.Name

    (Get-Esxcli -v2 -VMHost $_).system.module.parameters.set.Invoke(@{module="i40en"; parameterstring="LLDP=0,0,0,0,0,0,0,0"})

}


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

1 Reply
LucD
Leadership
Leadership
Jump to solution

When you use the V2 version of Get-EsxCli you have to provide all the parameters in a hash table.

See PowerCLI 6.3 R1: Get-ESXCLI Why the V2? for the details.

Get-cluster -name "VMCluster" |

%{

    Write-Host $_.Name

    (Get-Esxcli -v2 -VMHost $_).system.module.parameters.set.Invoke(@{module="i40en"; parameterstring="LLDP=0,0,0,0,0,0,0,0"})

}


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference