This content is part of the Essential Guide: Enable VMware automation with these top tools and techniques
Evaluate Weigh the pros and cons of technologies, products and projects you are considering.

Which CLI is best: vSphere CLI, PowerCLI or ESXi Shell?

VMware offers three CLI choices to run commands in a vSphere environment, but which one is the best option?

I found a specific command-line interface (CLI) in the vSphere documentation to execute a command I needed. Do...

I have to use that CLI when there are others I use more regularly?

VMware provides a number of command-line interface options for its customers to connect and manage a vSphere environment. There's the vSphere CLI (vCLI), PowerCLI, and also local commands inside the ESXi Shell. Despite these options, choosing a CLI comes down to an administrator's preference.

For example, let's take the creation of a vSphere standard virtual switch with vmnic2 as an uplink. All three CLIs have the ability to do it, some in more ways than one. However, the syntax required to get there is different for each.


vicfg-vswitch –server ESXiServerName –username username –password password –a TempSwitch

vicfg-vswitch –server ESXiServerName –username username –password password TempSwitch –L vmnic2


esxcli –server ESXiServerName –username username –password password network vswitch standard add –v TempSwitch

esxcli –server ESXiServerName –username username –password password network vswitch standard uplink add –u vmnic2 –v TempSwitch

ESXi Shell

esxcfg-vswitch –a TempSwitch

esxcfg-vswitch TempSwitch –L vmnic2


esxcli network vswitch standard add –v TempSwitch

esxcli network vswitch standard uplink add –u vmnic2 –v TempSwitch


New-VirtualSwitch –VMHost ESXiServerName –Name TempSwitch –Nic vmnic2


$esxcli = Get-ESXCLI –VMhost ESXiServerName


$esxcli network.vswitch.standard.uplink.add("vmnic2","TempSwitch")

Similarities and a caveat

The vCLI and ESXi Shell functions are very similar, with the difference being vCLI requires you to provide the name and credentials of your ESXi host. The ESXi Shell always defaults its credentials to the logged-in local host. Note the vCLI contains esxcfg commands, which are present for backward-compatibility reasons and may be phased out in a future vSphere release. The esxcli namespace commands are available in all three CLIs.

Pick your poison

How do you choose which CLI to use? If you are used to scripting in bash and perl, then the vCLI is probably going to be your best option. If you are more of a Windows and PowerShell person, the PowerCLI cmdlets will be the way to go. 

I personally use a combination of all three of them: vCLI when I need to integrate with other native Linux-type commands like grep and sed, ESXi Shell when performing troubleshooting, and PowerCLI for reporting, automation, and pretty much everything else. 

Either way, the result will be the same no matter what CLI option you choose; it's simply a matter of comfort.

Dig Deeper on Troubleshooting VMware products

Join the conversation


Send me notifications when other members comment.

Please create a username to comment.

Which CLI do you prefer to use?
Powerful tool, and is often more efficient and offers more options than the relevant GUI works anywhere uses less bandwidth and you can script stuff
Power CLI is good for troubleshooting
Before you can use the IBM Storage Enhancements for VMware vSphere Web Client on the web client side, you need to define on the IBM Storage Integration Server side the vCenter servers for which you want to provide storage resources attach storage pools that you want to make available to each vCenter server Use the vwc_vcenter and vwc_poolCLI commands to add, modify, remove, or list vCenter servers, and also to attach or detach storage pools that were predefined on the IBM storage systems you have added. The vwc_host command is required for ESXi host definition on DS8000® arrays