[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

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

Posted on 2011-10-13
15
Medium Priority
?
4,103 Views
Last Modified: 2013-11-05
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.






0
Comment
Question by:jackiechen858
  • 9
  • 6
15 Comments
 
LVL 124
ID: 36966074
I believe esxcli is not vCenter aware, meaning you must connect to a specific ESX or ESXi host when performing an operation.
0
 
LVL 124
ID: 36966094
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
0
 
LVL 7

Author Comment

by:jackiechen858
ID: 36966418
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.


0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 124
ID: 36967784
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!
0
 
LVL 124

Accepted Solution

by:
Andrew Hancock (VMware vExpert / EE MVE^2) earned 2000 total points
ID: 36967973
okay, this is not obvious, from the documents but vCLI 5.0

try

esxcli --server [vcenter-server] --vihost [esx(i)-host] .....

0
 
LVL 7

Author Comment

by:jackiechen858
ID: 36970582
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).


0
 
LVL 7

Author Comment

by:jackiechen858
ID: 36970600
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 :-)


0
 
LVL 124
ID: 36970608
these newer features for vCenter are included on 5.0.

download is here

http://www.vmware.com/support/developer/vcli/

(you need to login)

http://www.vmware.com/support/developer/vcli/vcli50/vsp5_50_vcli_relnotes.html
0
 
LVL 7

Author Comment

by:jackiechen858
ID: 36970986
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. )


















0
 
LVL 124
ID: 36970999
the first link is the download, you need a valid login, Weve got the tools here!
0
 
LVL 7

Author Comment

by:jackiechen858
ID: 36971011
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)
0
 
LVL 124
ID: 36971015
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!!!
0
 
LVL 124
ID: 36971020
YES very good you can read!
0
 
LVL 7

Author Comment

by:jackiechen858
ID: 36971024
Thanks, I see it now. I already download same installation file from the other "vSphere SDK for Perl" download url.

0
 
LVL 124
ID: 36971030
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.
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article, I show you step by step with screenshots to assist you - HOW TO: Deploy and Install the VMware vCenter Server Appliance 6.5 (VCSA 6.5), with some helpful tips along the way.
In this article, I will show you HOW TO: Perform a Physical to Virtual (P2V) Conversion the easy way from a computer backup (image).
Teach the user how to configure vSphere clusters to support the VMware FT feature Open vSphere Web Client: Verify vSphere HA is enabled: Verify netowrking for vMotion and FT Logging is in place or create it: Turn On FT for a virtual machine: Verify …
Advanced tutorial on how to run the esxtop command to capture a batch file in csv format in order to export the file and use it for performance analysis. He demonstrates how to download the file using a vSphere web client (or vSphere client) and exp…
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question