As part of my efforts to renew my VCP5-DCV certification to the new and shiny VCP6-DCV (not to mention avoiding having to take another week-long class in order to qualify to do so), I have been spinning up a lab environment to mess around with. Like when I was studying for VCP5-DCV, I am using Mastering VMware vSphere 6 by Nick Marshall as my go-to guide.
In my lab, I deployed an instance of the vSphere Management Assistant (vMA) so that I can run vSphere CLI commands such as esxcli. The deployment of vMA went without any problems, but I was having a bunch of trouble getting it to authenticate with vCenter.
esxcli –server=192.168.1.85 –vihost=192.168.1.249 -firstname.lastname@example.org network ip interface list
(It may whine about not having a certificate in the credential store… if so, add the certificate.
/usr/lib/vmware-vcli/apps/general/credstore_admin.pl add -s vcenter.ip.address.here -t [certificate])
Then I started getting a weird authentication error…
That’s weird. I tried the same password multiple times just to make sure I wasn’t typing it in wrong. No dice. I started looking online and found this thread:
Basically, this guy’s fix was to disconnect the host and reconnect it in vCenter. I tried that. It still failed.
Finally, I found the answer. https://pubs.vmware.com/vsphere-50/index.jsp?topic=%2Fcom.vmware.vcli.getstart.doc_50%2Fcli_jumpstart.3.4.html
After installation, run ESXCLI commands against a specific host by first specifying all dispatcher options. If the target server is a vCenter Server system, specify the target ESXi host before any ESXCLI namespaces, commands, and supported options.
It was purely a matter of what options in the command come first. I ran the command again like this:
Tada! Order DOES matter to esxcli. The book example will not work as formatted.
Up next: scripting the nightly shutdown of the lab.