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
VMware, Inc. 43
Chapter 5 Running DCLI Commands
dcli +credstore-remove +server <server> +username user1
3Listallcredentialstoreentries.
dcli +credstore-list
Order of Precedence for DCLI Authentication
WhenyourunaDCLIcommand,authenticationhappensintheorderofprecedenceshowninTable 5‐2,
“DCLIAuthenticationPrecedence,”onpage 43.Thisorderofprecedencealwaysapplies.Thatmeans,for
example,thatyoucanoverrideanenvironmentvariablesettingfromthecommandline.
IfyouareauthenticatingthroughvCenterSingle
Sign‐On,theorderofprecedenceispreserved.
Input, Output, and Return Codes
DCLIsupportsthefollowinginputarguments.
Basictypes.Youcanenterbasictypeslikestring,int,double,orbooleanonthecommandline.
Listtypes.ProvidethesameoptionmultipletimesonthecommandlineandDCLItreatsitasalist.
Structure.Forstructureinputfieldsusethedotnotation.Forexample,id.pathisthepathfieldintheid
structure.
Currentlysupportedoutputformattertypesaresimple,xml,html,table,csvandjson.Youcanchangethe
outputformatbypassingtheformatteroptiontoDCLI.
ForscriptingpurposesDCLI
returnsanon‐zeroerrorcodeforanunsuccessfulcommand.Toseethelast
commandstatusininteractivemode,runthe$?command.
Using DCLI with Variables
YoucanpredefineasetofvariablesintheenvironmentwhereyourunDCLIcommandssoyoudon’thaveto
passtheoptionseachtimeyourunacommand.Thefollowingenvironmentvariablesaresupported.
Table 5-2. DCLI Authentication Precedence
Authentication Description
Commandline Usernameandpassword,specifiedonthecommandlinetakesprecedence,evenifacredential
storeexists.
Environment
variable
Ausernamespecifiedinanenvironmentvariabletakesprecedenceoverusernamesinthe
credentialstore,butnotoverthecommandline.
Credentialstore Usernameandpasswordretrievedfromthe
credentialstore.Acustomcredentialstorefileata
non‐defaultlocationhasprecedenceoverafileatthedefaultlocation.
Table 5-3. Variables Supported by DCLI
Variable Description
DCLI_SERVER SetthisvariabletopasstheserverIPaddress.
Passingtheserveroptiononthecommandlineoverridesthisvariable.
DCLI_SSLCERTFILE SetthisvariabletopassthepathofyourSSLcertificatefile.
Passingthessl-cert-fileoptiononthecommandlineoverridesthisvariable.
DCLI_SSLKEYFILE Setthisvariabletopassthe
pathofyourSSLkeyfile.
Passingthessl-key-file optiononthecommandlineoverridesthisvariable.
DCLI_CACERTFILE SetthisvariabletopassthepathofaCAcertificatefile.
Passingthecacert-fileoptiononthecommandlineoverridesthisvariable.
DCLI_USERNAME Setthisvariabletopasstheusernamerequiredfor
authentication
Passingtheusernameoptiononcommandlineoverridesthisvariable.