Hello,
I'd like to use get-esxcli to run the following command, I also need to run it against specific clusters, or maybe by importing from a CSV file please.
esxcli system wbem set --enable false
Thank you,
Try like this
$esxcli = Get-EsxCli -VMHost $esxName -V2
$esxcli.system.wbem.set.Invoke(@{enable=$false})
$esxcli.system.wbem.get.Invoke()
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
When you want to run this against all hosts in a cluster, you could do
ForEach-Object -Process {
$esxcli = Get-EsxCli -VMHost $_ -V2
$esxcli.system.wbem.set.Invoke(@{enable=$false})
$esxcli.system.wbem.get.Invoke()
}
And when you want to select the ESXi nodes via a CSV, you could do.
This snippet assumes the CSV has a column with the name VMHost.
ForEach-Object -Process {
$esxcli = Get-EsxCli -VMHost $_.VMHost -V2
$esxcli.system.wbem.set.Invoke(@{enable=$false})
$esxcli.system.wbem.get.Invoke()
}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I will try them tomorrow and let you know the result.
Be safe!