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"?

  • 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
    19 Mar, 2019 07:11am

     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


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

  • Dan Barr commented
    19 Sep, 2018 01:13pm

    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
    19 Sep, 2018 11:10am

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

  • Luc Dekens commented
    19 Sep, 2018 05:07am

    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?