Score:0

write shell script or other script on vCenter

cn flag

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?

Score:3
in flag

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.

Score:2
it flag

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.

in flag
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)
Krackout avatar
it flag
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.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.