No matter what kind of technology you administer -- switches, routers, Windows servers or VMware servers -- you...
By submitting your email address, you agree to receive emails regarding relevant topic offers from TechTarget and its partners. You can withdraw your consent at any time. Contact TechTarget at 275 Grove Street, Newton, MA.
will reach a point where you just want to control it from the command line or, even better, with a script.
When VMware ESXi came out and it didn't have a supported command-line interface, VMware had to provide some solutions for power administrators who were used to using the service console. To fill this hole, VMware created its Remote Command-Line Interface (or Remote CLI) and Virtual Infrastructure Management Assistant (VIMA), which included Remote CLI.
When vSphere 4 came out, VMware rereleased both VIMA and Remote CLI with new names, new version numbers and some new features. Remote CLI installs on your local Windows or Linux PC and is used to manage ESX servers from the command line. VIMA is a virtual appliance that runs inside your VMware infrastructure. VIMA includes the Remote CLI, as well as a few other command-line tools.
Now, let's talk about the latest version of the Remote CLI, how to download and install it, and how it can help you.
When VMware released vSphere 4 in May of 2009, VMware not only changed the name and version of VIMA but it also changed the name and version of Remote CLI to vSphere Command-Line Interface, or vCLI. When Remote CLI 1.0 became vCLI 4.0 (to match vSphere 4) it was more than just a name and version number change.
vCLI 4.0 now offers a number of additional commands, IPv6 support, ability to run resxtop through vCenter, new options for vicfg-route, and, of course, vSphere 4 compatibility.
The new version of vCLI 4.0 is included with vMA 4.0.
Why should you use vCLI in the first place? First, it allows you to have a command-line interface on VMware ESXi servers where you otherwise wouldn't have one. That allows you to configure features of an ESXi server that you otherwise couldn't configure. Second, it allows you to control both ESXi and ESX servers from your local PC, enabling you to run scripts on those vSphere servers from your local PC. Third, you can perform esxtop, performance management from the command line on a vCenter server. Finally, you can apply software updates via the command line.
Downloading and Installing vCLI 4.0
Downloading and installing vCLI is just like most other Windows or Linux applications; the difference comes after you install it. To download vCLI, you will just need to download it from the VMware vCLI website. Note that if you don't have a free VMware login, you will need to register for one to download vCLI. After clicking on Download and accepting the license agreement you will see the screen below, where you can download vCLI for Windows or for 32-bit or 64-bit Linux.
In my case, I chose to download the 46 MB Windows installer.
I ran the executable and the installation of vCLI was very typical. I clicked Next, accept license agreement, then Next, and Next again (to take the default install version), and Install.
The installation of vCLI was done in a few seconds and I clicked Finish. From here, I could see the new vCLI command prompt in my Start Menu -> Programs -> VMware -> vCLI menu (which I ran).
The command prompt really just starts the Windows command prompt and puts you in the directory for vCLI. From here, you just need to CD bin (change directory into the bin directory) and you can do a DIR to see all the commands that you can run with vCLI (as in the figure below).
The esxcfg-xxxx commands have been deprecated and now point to the vicfg-xxxx commands. Honestly, there is a lot to these commands so before you read the next section in this article, I highly recommend that you read the command reference for the vCLI as it covers each of the commands that you see in the image above.
5 cool vCLI commands
In the image above, you see all the commands that you can run with the vCLI. There are a lot of them. Where do you start? I suggest starting with these five commands that I have run and think are useful (and cool).
- vihostupdate -- Patches ESX or ESXi servers with update "bulletins" from VMware.
- esxcli -- Storage path and storage plug-in management (plugable storage architecture).
- vicfg-iscsi -- Full iSCSI SAN configuration from the command line.
- svmotion -- Allows you to migrate a virtual machine's storage from one data store to another.
- vifs -- Used for all sorts of file operations on ESX and ESXi hosts (ie: dir, mkdir, copy, put, get, move and more).
For every command you run, you will need to specify the ESX or ESXi server or the vCenter server as well as your authentication credentials. There are actually more than five ways to do this is if you read the vCLI command reference.
Of course, all the vicfg-xxxx commands are available to allow you to configure storage, networking, security and more, from the command line. Keep in mind that the esxcfg-xxxx commands are very helpful (if you need to accomplish a configuration from the command line).
To get command-line access to your ESX, ESXi and vCenter servers I recommend that you download vCLI 4.0 here to get the latest vSphere version and make sure you read the vCLI command reference and vCLI release notes.
More on VMware's remote command-line interface
|David Davis is the director of infrastructure at TrainSignal.com . He has a number of certifications including vExpert, VCP, CCIE #9369 and CISSP. Davis has also authored hundreds of articles and six different video training courses at Train Signal with his most popular course being the VMware vSphere 4 video training course. His personal website is VMwareVideos.com . You can follow Davis on Twitter or connect with Davis on LinkedIn.|