Uncategorized

ESXCLI now available through PowerCLI

I’ll illustrate esxcli in PowerCLI with an example of how path selection policy can be set for specific storage array type plugin. As you may know, until now this action could be performed by the esxcli command line tool and the call would look something like:

    esxcli nmp satp setdefaultpsp -psp VMW_PSP_RR -satp VMW_SATP_SYMM

From this release the esxcli functionality is available directly through the PowerCLI. The only thing you have to do is to retrieve an EsxCli instance and then invoke any of its methods. So it will look like:

    $esxCli = Get-EsxCli –Server $myEsxConnection

    $esxCli.nmp.satp.setdefaultpsp(“VMW_PSP_RR”, “VMW_SATP_SYMM”)

Note that you have to be connected directly to your ESX, in order to retrieve EsxCli instance (It won’t work with VMHost instances, retrieved from a VC).

In the esxcli tool you have applications, which are grouped in namespaces. Those applications have commands. The same organization is preserved in PowerCLI – The EsxCli object contains the namespaces as properties. The namespace objects contain the applications as properties and finally the commands are methods of those application objects. It’s quite easy to get help for those methods. What you have to do is to call help method for some application object, specifying the name of the desired command method:

    $esxCli.nmp.satp.help("setdefaultpsp") 

You can also retrieve help for the entire application:

    $esxCli.nmp.satp.help()

Note that this feature is experimental. This means that in future releases backward compatibility is not guarantied.

If you’d like to take a deeper look in the PowerCLI’s esxcli interface, you can read this article: ESXCLI in PowerCLI – overview