Link to home
Start Free TrialLog in
Avatar of jackiechen858
jackiechen858Flag for Canada

asked on

how to use vsphere CLI to run esxcli to get information for a host with vCenter credential

I want to run a command like "esxcli swiscsi nic list -d vmhba35" to get some iSCSI information. I can run it directly on ESX host. Now there is a ESX host under a vCenter management, I have credential for the vCenter, but not the ESX hots directly.

I installed vsphere CLI on a Linux machine,  I found I can do

esxcli --server=ESXHOST --username=ESXUSER  --password=ESXPASSWORD swiscsi nic list -d vmhba35


But I don't know how to do it with vCenter credential only.






Avatar of Andrew Hancock (VMware vExpert PRO / EE Fellow/British Beekeeper)
Andrew Hancock (VMware vExpert PRO / EE Fellow/British Beekeeper)
Flag of United Kingdom of Great Britain and Northern Ireland image

I believe esxcli is not vCenter aware, meaning you must connect to a specific ESX or ESXi host when performing an operation.
rather than me comment on esxcli, checkout this article by fellow vEXPERT William Lam!

which explains The new remote version of esxcli is compatible with both ESXi 5 and ESX(i) 4.1 hosts.
Article Source
http://www.virtuallyghetto.com/2011/07/major-enhancements-in-esxcli-for.html
Avatar of jackiechen858

ASKER

this article:

http://www.vmware.com/support/developer/vcli/vcli41/vsp4_41_vcli_relnotes.html


mentioned " You can run most vSphere CLI commands against a vCenter Server system and target any ESX/ESXi system that the vCenter Server system manages. vSphere CLI commands are especially useful for ESXi hosts because ESXi does not include a service console."

Guess I was misled.


It states "You can run most vSphere CLI commands against a vCenter Server......"

 I've never seen esxcli commands used against vCenter, always against a host, and fellow fellow vEXPERT William Lam,, does not mention vCenter in his recent article.

there is lots of confusion, in the industry as to what vSphere is, is it the host or vcenter, or both!
ASKER CERTIFIED SOLUTION
Avatar of Andrew Hancock (VMware vExpert PRO / EE Fellow/British Beekeeper)
Andrew Hancock (VMware vExpert PRO / EE Fellow/British Beekeeper)
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hmm, I can't even find the vsphere CLI 5.0. Only found a vsphere PowerCLI 5.0 but I think it's different animal ( I used 4.0 version vsphere PowerCli before).


Yeah, seems CLI 5.0 is not out yet. 4.1 CLI doesn't have --vihost for esxcli.

I will just accept your post anyway :-)


The links you provided are just release note?


I think they changed the name. I downloaded "VMware vSphere 5.0 SDK for Perl" and seems that's the cli. it even uninstalled my previous installed vsphere 4.1 CLI.

I just tried it, quiet a exercise.  After installed vCli 5.0 on a 2003 VM, it put a esxcli.exe there, but when I run it, I got a error "The system cannot execute the specified program."

After spending some time to google and check event log, I found the error in event log is "Dependent Assembly Microsoft.VC90.CRT could not be found and Last Error was The referenced assembly is not installed on your system."

The fix is to download VS2008 runtime from http://code.google.com/p/userinfoex/downloads/detail?name=Microsoft.VC90.CRT.zip&can=2&q=

and put those dlls in the same folder as esxcli.

Very disappointed with Vmware's QA.


Tried to run it, it now support -h ( --vihost ), but doesn't work with my vCenter 4.1 ( this is not a surprise, I knew it probably will not work, just want to give it a try. )


















the first link is the download, you need a valid login, Weve got the tools here!
oh, actually the first link can download the vCli:

VMware vSphere CLI (vCLI) - Windows Installer
Command-line tools (for Windows environments) to manage your vSphere infrastructure.         48M       exe
(md5sum:0cfe27849d6e27553fe745f2074d9072)
(sha1sum:464068effc0f03f16bd804712cb00f86d50b4f58)

It's exactly same as the one I downloaded:

vSphere SDK for Perl - Windows Installer
Download an SDK for Windows environments that allows to create Perl scripts to automate vSphere management.         48M       exe
(md5sum:0cfe27849d6e27553fe745f2074d9072)
(sha1sum:464068effc0f03f16bd804712cb00f86d50b4f58)
click the first link, look for the word DOWNLOAD which you have missed, LOGIN accept EULA and download!

I cannot give you exact url because its hashed with our VMware Partner password, we not numpties at this!!!
Thanks, I see it now. I already download same installation file from the other "vSphere SDK for Perl" download url.

this version is vCLI 5.0, now it would not surprise me, if this has to match vSphere 5.0 ESXi 5.0 hosts, and vCenter 5.0.