ESXCLI is a set of useful namespaces to get (retrieve) or set (change) ESXi host configuration and truly is the real successor of ESXCFG commands in the roadmap of VMware CLI development. In addition, PowerCLI is a perfect option that we can use to gain the benefits of automation! Because it's possible to execute the ESXi shell's command through PowerCLI, as the network administrator you may require to run some ESXCLI commands via PowerCLI.
In this post, I explain how to achieve this goal by running a sample of retrieving options: Get the current Syslog configuration of all the ESXi hosts. So if we want to do it via esxcli, I should run this for all the ESXi hosts one by one through the shell and running of this command:
esxcli system syslog config get
Although I need to get this via for all the ESXi (named like VH*) by a foreach loop, First I need to create a variable ($MyESXs) to get the required ESXi value (for example its name):
In Windows PowerShell environment |
At last you can easily run the corresponding ps1 file inside your pwsh-preview (PowerShell of the Linux Shell):
No comments:
Post a Comment