esxcli
is existed on vSphere
. But I need to write script on vCenter
and vCenter
doesn't have esxcli
command.
How can I write script for vCenter
?

- 602
- 8
- 21
2 Answers
You don't write scripts directly on vCenter. It has an API, there are libraries to access the API for many scripting languages. Pick a language of your choice, read it's documentation and write your script on any host you like.

- 23,274
- 8
- 57
- 89
You can use Vmware's PowerCLI
tool.
From Vmware,
VMware PowerCLI is a command-line and scripting tool built on Windows PowerShell, and provides more than 800 cmdlets for managing and automating VMware vSphere, VMware Cloud Director, vRealize Operations Manager, vSAN, VMware NSX-T Data Center, VMware Cloud Services, VMware Cloud on AWS, VMware HCX, VMware Site Recovery Manager, and VMware Horizon environments.
You can also use it on Linux workstations, after installing Powershell for Linux. Probably the commands/cmdlets added to powershell by PowerCLI can help you script whatever you need.

- 1,575
- 7
- 20
-
PowerCLI does not, however, run directly on the vCenter Appliance. And running it on Linux has it's disadvantages (for example, you can't store credentials, which you can on Windows) – Gerald Schneider Dec 25 '21 at 13:47
-
Good to point out these drawbacks. On the other hand, powershell scripting is generally more viable for a sysadmin than connecting to an API through a general purpose language. – Krackout Dec 25 '21 at 14:01