VMware PowerCLI

The Best User Interface for your VMware Datacenter!

Execute commands on ESXi easy

I would like to have a cmdlet to execute commands on the ESXi itself and get the Output. I'm aware of the PoshSSH, but I don't like to start the SSH service, disable lockdown, pass the credentials and do all the other stuff needed each time. 
Wouldn't It be nice to have something like this: New-VMHostCMD -vmhost myESX -cmd "vmkping 192.168.1.1"?

  • Guest
  • Sep 18 2018
  • Will not implement
  • Mar 18, 2019

    Admin response

    VMware is gradually moving away from CLIs on the hosts in favor of REST APIs

  • Attach files
  • Guest commented
    March 19, 2019 07:11

     The primary driver for this Idea was, that I need to execute a command like this:

    /usr/lib/vmware/vmkmgmt_keyval/vmkmgmt_keyval -l -i vmhba1/qlogic

    Locally.

    I look forward to do this through a REST API soon. Thank you.

  • Dan Barr commented
    September 19, 2018 13:13

    To Luc's point, for whatever host command line tasks may not be available through esxcli (and thus available thru Get-EsxCli), I'd rather see efforts directed at making those functions available in the APIs so they can be consumed "properly" by PowerCLI rather than a generic command interpreter for the host shell, which could introduce all kinds of opportunity for misuse.

  • Guest commented
    September 19, 2018 11:10

    ESXCLi is the way forward. I almost get all the work done by $esxcli = Get-ESXCLi 

  • Luc Dekens commented
    September 19, 2018 05:07

    I think the example you are giving is not the best one, since that functionality is available through esxcli, and hence also throug Get-EsxCli ($esxcli.network.diag.ping).

    Perhaps this should sooner go in the direction of extending the esxcli/Get-EsxCli cmd/cmdlet?