0

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?

2 Answers 2

3

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.

2

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.

2
  • 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) Dec 25, 2021 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, 2021 at 14:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .