VMware Cloud Community
kurth83
Contributor
Contributor

esxcli vs automation API

I recently was led to believe that powerCLI uses vcenter automation API underneath.

I want to use the low-lever API for my automation needs, powershell is too slow

and too much setup, this is for developing a product, eliminating the powershell dependency would help a lot.

But I can't find any documentation on how to access the $esxcli stuff in the automation API documentation:

vSphere Automation API - VMware API Explorer - VMware {code}

I have an authorization to vCenter (not the ESX's), and want to do stuff like:

$esxcli.network.diag.ping.Invoke();

$esxcli.storage.nmp.satp.rule.add.Invoke();

I am *very* familiar with the old SOAP java API's, and the object browser for vCenter,

and not so much with the REST API's, but I don't see anything there that

lets me get the the esxcli, anybody know what PowerCLI is doing there?

Or a way to trace what PowerCLI is doing?

Thanks.

0 Kudos
8 Replies
LucD
Leadership
Leadership

You can use the esxcli commands via the Get-EsxCli cmdlet.

See the PowerCLI 6.3 R1: Get-ESXCLI Why the V2? blog post for more info.

To use the vSphere API methods and properties you have access to these via the Get-View cmdlet and the ExtensionData property.

See the Get-View series of blog posts for more info.

Start with Get-View Part 1: Introduction to Get-View


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

0 Kudos
kurth83
Contributor
Contributor

Can you point me to the vsphere automation doc for the REST API's that do the same thing?

I can't seem to find them on my own.

thanks

0 Kudos
LucD
Leadership
Leadership

You can find the reference here.


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

0 Kudos
kurth83
Contributor
Contributor

I read through a lot of it, some parts of it are familiar and some are not, but not seeing esxcli in there anywhere obvious.

At this point I am considering decompiling the powershell .net dll's, that will let me know what it is doing if I am not to obtuse to follow it.

I am thinking I need sample source code at this point to follow anyway.

0 Kudos
LucD
Leadership
Leadership

For esxcli commands you will need to use the Get-EsxCli cmdlet.

The esxcli command uses some private API.

Also, William's post Hidden esxcli APIs might help (a bit).


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

kurth83
Contributor
Contributor

Yes!  Those hidden API's are exactly what I was looking for.  Shame they still aren't public AFAIK.

Many thanks.

0 Kudos
kurth83
Contributor
Contributor

I had to retract the correct answer, tried it, the api given requires hitting the ESX host and requires credentials for ESX to use, I need a vcenter solution.

Anyway I have posted several of these threads, and I found an answer that works for me, I found out how to install powercli on VCSA.  I will be posting detailed instructions in the powerCLI forum.

0 Kudos
LucD
Leadership
Leadership

That is a very bad idea!


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

0 Kudos