This post is to discuss various command line options to manage vSphere environment, and steps to quickly get started with them.
Modes:
- ESXi Shell: via Console or putty
- vCLI
- vMA
- PowerCLI
1. ESXi Shell
Straight forward – connect via putty or directly via console- Alt+F1.
Supported: esxcli, esxcfg-* (deprecated), localcli (to bypass unresponsive hostd and restart), esxtop, vimcmd, vmware-cmd, vmkfstools, pktcap-uw etc.,
2. vCLI:
(To install in Windows) Download exe from my.vmware — Install & Reboot.
Launch CLI window — CD to C:\Program Files (x86)\VMware\VMware vSphere CLI\bin and start running commands.
Supported: esxcli, vicfg-*.pl (to be deprecated),
Connection Syntax:
esxcli –server –username snow\-white –password dwarf\$ network ip interface list
To avoid typing credentials, add servers using (note the different folder path)-
C:\Program Files (x86)\VMware\VMware vSphere CLI\Perl\apps\general>credstore_admin.pl add –server –username –password (“” for empty pwd)
credstore_admin.pl add –server –thumbprint
(otherwise shows thumbprint error)
3. vMA (to be deprecated with 6.5):
Download vMA from VMware site — Deploy OVF, Login to console — Select 6 from menu — set ipv4 IP, Netmask — Exit program by selecting 3 — configure vi-admin user password. vMA is now configured for remote login/management (https://IP:5480)
Supported: esxcli, vicfg-* (to be deprecated). Same cmd syntax as vCLI (without .pl)- just no need to cd to specific directories. credstore_admin not avialable, instead use vifp as below.
Connection Syntax:
vifp listservers (To view ESXi hosts that are added to vMA)
vifp addserver –authpolicy fpauth –username root –password (To add an ESXi host to VMA)
vifptarget –s (To execute commands against any of added hosts)
4. PowerCLI
(To install in Windows) Download exe from my.vmware & Install
Supported:powershell cmdlets E.g. Get-Datastore, Get-Help
Connect-VIServer and enter credentials in pop up. Start running cmdlets