Essential Guide

Top tools and techniques for VMware automation

A comprehensive collection of articles, videos and more, hand-picked by our editors

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.

This was last published in April 2014

Essential Guide

Top tools and techniques for VMware automation

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.
Related Discussions

Mike Preston asks:

Which CLI do you prefer to use?

2  Responses So Far

Join the Discussion

1 comment


Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: