6.0
Table Of Contents
- Getting Started with vSphere Command-Line Interfaces
- Contents
- About This Book
- Managing vSphere with Command-Line Interfaces
- Installing vCLI
- Running Host Management Commands in the ESXi Shell
- Running vCLI Host Management Commands
- Overview of Running vCLI Host Management Commands
- Protecting Passwords
- Authenticating Through vCenter Server and vCenter Single Sign-On
- Authenticating Directly to the Host
- Trust Relationship Requirement for ESXCLI Commands
- Common Options for vCLI Host Management Command Execution
- Using vCLI Commands in Scripts
- Running Host Management Commands from a Windows System
- Running Host Management Commands from a Linux System
- Running DCLI Commands
- Index
Getting Started with vSphere Command-Line Interfaces
10 VMware, Inc.
Using ESXCLI for Host Management
YoucanmanagemanyaspectsofanESXihostwithcommandsintheESXCLIcommandset.Youcanrun
ESXCLIcommandsasvCLIcommands,orrunthemintheESXiShellintroubleshootingsituations.
YoucanalsorunESXCLIcommandsfromthePowerCLIshellbyusingtheGet-EsxClicmdlet.Seethe
vSphere
PowerCLIAdministrationGuideandthevSpherePowerCLIReference.
ThesetofESXCLIcommandsthatareavailableonahostdependsonthehostconfiguration.ThevSphere
Command‐LineInterfaceReferencelistshelpinformationforallESXCLIcommands.Youcanrunesxcli
--server <MyESXi> --helpbeforeyourunacommandona
hosttomakesurethatthecommandisdefined
onthehostyouaretargeting.
ESXCLI Syntax
EachESXCLIcommandusesthesamesyntax.
esxcli [dispatcher options] <namespace> [<namespace> ...] <cmd> [cmd options]
dispatcheroptions.Predefinedoptionsforconnectioninformationsuchastargethost,username,andso
on.SeeChapter 4,“RunningvCLIHostManagementCommands,”onpage 27.Notrequiredwhenyou
runthecommandintheESXiShell.IfthetargetserverisavCenterServersystem,specifythetargetESXi
host
beforeanyESXCLInamespaces,commands,andsupportedoptions.
ManyESXCLIcommandsgenerateoutputyoumightwanttouseinyourapplication.Youcanrunesxcli
withthe--formatterdispatcheroptionandsendtheresultingoutputasinputtoaparser.
namespace.GroupsESXCLIcommands.vSphere5.0andlatersupportnestednamespaces.
command.Reportsonormodifiesstateonthesystem.
Examples
esxcli --server myESXi --username user1 --password 'my_password' storage nfs list
esxcli --server myVCServer --username user1 --password 'my_pwd' --vihost myESXi.mycompany.com
storage nfs list
options.Manycommandssupportoneormoreoptions,displayedinthehelporthevCLIReference.For
somecommands,multipleoptionvalues,separatedbyspaces,arepossible.
Example
esxcli system module parameters set -m <module> -p "a=1 b=1 c=1"
Running ESXCLI vCLI Commands
YoucanrunanESXCLIvCLIcommandintheESXiShellfortroubleshootingandremotelyagainstaspecific
hostoragainstavCenterServersystem.Youhavethefollowingchoices:
DeploythevMAapplianceonanESXisystemandauthenticateagainstasetoftargetservers.Youcan
thenrunESXCLIcommandsagainstanytargetserverbyspecifyingthe--hostdispatcheroption.No
additionalauthenticationisrequired.SeethevSphereManagementAssistantGuide.
I
MPORTANTStartingwithvSphere6.0,ESXCLIexpectsatrustrelationshipbetweenthetargethostand
thesystemonwhichyourunthecommand.Youcanestablishthisrelationshipinoneoftheseways:
Usethe--cacertsfileoptionorVI_CACERTFILE variable
Storethethumbprintinthesessionfile.
Specifythethumbprintwiththe--thumbprintoptionorVI_THUMBPRINTvariable.
Youcanpassinthethumbprintthatisreturnedintheerrorifyoutrustthehostyouaretargeting.See
“TrustRelationshipRequirementforESXCLICommands”onpage 33foranexample.