Академический Документы
Профессиональный Документы
Культура Документы
Command-Line Interfaces
ESXi 5.1
vCenter Server 5.1
EN-000886-00
You can find the most up-to-date technical documentation on the VMware Web site at:
http://www.vmware.com/support/
The VMware Web site also provides the latest product updates.
If you have comments about this documentation, submit your feedback to:
docfeedback@vmware.com
Copyright 20102012 VMware, Inc. All rights reserved. This product is protected by U.S. and international copyright and
intellectual property laws. VMware products are covered by one or more patents listed at
http://www.vmware.com/go/patents.
VMware is a registered trademark or trademark of VMware, Inc. in the United States and/or other jurisdictions. All other marks
and names mentioned herein may be trademarks of their respective companies.
VMware, Inc.
3401 Hillview Ave.
Palo Alto, CA 94304
www.vmware.com
VMware, Inc.
Contents
AboutThisBook
1 ManagingvSpherewithCommandLineInterfaces 7
OverviewofvSphereCommandLineInterfaces 7
UsingthevSphereCommandLineInterface 8
UsingESXCLI 8
ESXCLISyntax 8
RunningESXCLIvCLICommands 9
CommandSyntax 9
CommandSupportwhenHostandvCLIVersionDoNotMatch 9
RunningESXCLICommandsintheESXiShell 9
ESXiShellAccesswiththeDirectConsole 10
EnablingLocalESXiShellAccess 10
UsingtheLocalESXiShell 11
RemoteESXiShellAccesswithSSH 11
EnablingSSHfortheESXiShell 11
UsingtheESXiShellwithSSH 12
2 InstallingvCLI 13
InstallationOverview 13
OverviewofLinuxInstallationProcess 14
InstallingthevCLIPackageonRedHatEnterpriseLinux 16
InstallingRequiredPrerequisiteSoftwareforRedHatEnterpriseLinux 16
InstallingthevCLIPackageonRHEL(NoInternetAccess) 16
InstallingvCLIonLinuxSystemswithInternetAccess 17
InstallingRequiredPrerequisiteSoftwareforLinuxSystemswithInternetAccess 17
InstallingthevCLIPackageonaLinuxSystemwithInternetAccess 18
RunningCommandsonLinux 19
UninstallingthevCLIPackageonLinux 19
InstallingandUninstallingvCLIonWindows 19
RunningCommandsonWindows 20
UninstallingthevCLIPackageonWindows 20
EnablingCertificateVerification 21
DeployingvMA 21
3 UsingthevSphereCommandLineInterface 23
OverviewofRunningCommands 23
SpecifyingAuthenticationInformation 24
OrderofPrecedenceforvCLIAuthentication 24
UsingaSessionFile 24
UsingEnvironmentVariables 25
UsingaConfigurationFile 25
UsingCommandLineOptions 26
UsingMicrosoftWindowsSecuritySupportProviderInterface 27
vCLIandLockdownMode 27
CommonOptionsforvCLIExecution 27
UsingvCLICommandsinScripts 29
VMware, Inc.
ESXCLICommandHierarchies 31
esxcliesxcliNamespace 31
esxclifcoeNamespace 31
esxclihardwareNamespace 32
esxcliiscsiNamespace 32
esxclinetworkNamespace 33
esxclischedNamespace 34
esxclisoftwareNamespace 34
esxclistorageNamespace 35
esxclisystemNamespace 36
esxclivmNamespace 36
VMware, Inc.
GettingStartedwithvSphereCommandLineInterfacesgivesanoverviewofcommandlineinterfacesin
vSphere 5.0andvSphere5.1andgetsyoustartedwithESXiShellcommandsandvCLI(VMwarevSphere
CommandLineInterface)commands.ThisbookalsoincludesinstructionsforinstallingvCLIandareference
toconnectionparameters.
Intended Audience
ThisbookisforexperiencedWindowsorLinuxsystemadministratorswhoarefamiliarwithvSphere
administrationtasksanddatacenteroperations.
Document Feedback
VMwarewelcomesyoursuggestionsforimprovingourdocumentation.Ifyouhavecomments,sendyour
feedbacktodocfeedback@vmware.com.
Related Documentation
ThedocumentationforvCLIisavailableinthevSphereDocumentationCenterandonthevCLI
documentationpage.Gotohttp://www.vmware.com/support/pubs,selectVMwareAdministration
Products,andselectvSphereCommandLineInterface.
CommandLineManagementinvSphere5forServiceConsoleUsersisatechnicalnoteforuserswhoare
currentlyusingESXserviceconsolecommands,scripts,agents,orlogs.Youlearnhowtotransitiontoan
offhostimplementationortousetheESXiShellinspecialcases.
vSphereCommandLineInterfaceConceptsandExamplespresentsusageexamplesformanycommands,such
assettingupsoftwareandhardwareiSCSI,addingvirtualswitches,settingupActiveDirectory
authentication,andsoon.ThedocumentincludesthesameexamplewiththeESXCLIcommandandwith
thevicfg-command.
vSphereCommandLineInterfaceReferenceisareferencetobothESXCLIcommandsandvicfg-commands.
Thevicfg-commandhelpisgeneratedfromthePODavailableforeachcommand,runpod2htmlfor
anyvicfg-commandtogenerateindividualHTMLfilesinteractively.TheESXCLIreferenceinformation
isgeneratedfromtheESXCLIhelp.
ThedocumentationforPowerCLIisavailableinthevSphereDocumentationCenterandonthePowerCLI
documentationpage.Gotohttp://www.vmware.com/support/pubs,selectVMwareAdministration
Products,andselectvSpherePowerCLIdocumentation.
VMware, Inc.
ThevSphereSDKforPerldocumentationexplainshowyoucanusethevSphereSDKforPerlandrelated
utilityapplicationstomanageyourvSphereenvironment.Thedocumentationincludesinformationaboutthe
vSphereSDKforPerlUtilityApplications.
ThevSphereManagementAssistantGuideexplainshowtoinstallandusethevSphereManagementAssistant
(vMA).vMAisavirtualmachinethatincludesvCLIandotherprepackagedsoftware.SeeDeployingvMA
onpage 21.
BackgroundinformationforthetasksdiscussedinthisbookisavailableinthevSpheredocumentationset.The
vSpheredocumentationconsistsofthecombinedVMwarevCenterServerandESXidocumentation.
Support Offerings
TofindouthowVMwaresupportofferingscanhelpmeetyourbusinessneeds,goto
http://www.vmware.com/support/services.
VMware, Inc.
vSpheresupportsseveralcommandlineinterfacesformanagingyourvirtualinfrastructureincludingthe
vSphereCommandLineInterface(vCLI),asetofESXiShellcommands,andPowerCLI.Youcanchoosethe
CLIsetbestsuitedforyourneeds,andwritescriptstoautomateyourCLItasks.
Thischapterincludesthefollowingtopics:
OverviewofvSphereCommandLineInterfacesonpage 7
UsingthevSphereCommandLineInterfaceonpage 8
UsingESXCLIonpage 8
ESXiShellAccesswiththeDirectConsoleonpage 10
RemoteESXiShellAccesswithSSHonpage 11
Description
ESXCLIcommands
ManagemanyaspectsofanESXihost.YoucanrunESXCLI
commandsremotelyorintheESXiShell.
vCLIpackage.InstallthevCLIpackageontheserverofyour
choice,ordeployavMAvirtualmachineandtargettheESXi
systemthatyouwantmanipulate.YoucanrunESXCLI
commandsagainstavCenterServersystemandtargetthe
hostindirectly.RunningagainstvCenterServersystemsby
usingthe-vihostparameterisrequiredifthehostisin
lockdownmode.
ESXishell.RunESXCLIcommandsinthelocalESXishellto
managethathost.
See
UsingESXCLIonpage 8
InstallingvCLIon
page 13
vSphereCommandLine
ConceptsandExamples
vSphereManagement
AssistantGuide
vSphereCommandLine
InterfaceReference
YoucanalsorunESXCLIcommandsfromthevSpherePowerCLI
promptbyusingtheGet-EsxClicmdlet.
esxcfg-commands
AvailableintheESXiShell.esxcfg-commandsarestillincluded
inthisreleasebutaredeprecated.MigratetoESXCLIwhere
possible.ESXCLIreplacementsexistformostcommands.
CommandLineManagement
ofvSphere5forService
ConsoleUsers
vicfg-andother
vCLIcommands
IntroducedinvSphere3toallowuserstomanagehostsremotely.
InstallthevCLIpackageontheserverofyourchoice,ordeploya
vMAvirtualmachineandtargettheESXisystemthatyouwant
manipulate.
vSphereCommandLine
ConceptsandExamples
YoucanrunthecommandsagainstESXisystemsoragainsta
vCenterServersystem.IfyoutargetavCenterServersystem,use
the--vihostoptiontospecifythetargetESXisystem.
InstallingvCLIonpage 13
vSphereCommandLine
InterfaceReference
Note:IftheESXisystemisinlockdownmode,youmustrun
commandsagainstthevCenterServersystemthatmanagesyour
ESXisystem.
VMware, Inc.
Command set
Description
See
VMwarePowerCLI
cmdlets
VMwarevSpherePowerCLIprovidesaWindowsPowerShell
interfacetothevSphereAPI.vSpherePowerCLIincludes
PowerShellcmdletsforadministeringvSpherecomponents.
VMwarePowerCLI
documentationset.
vSpherePowerCLIincludesmorethan200cmdlets,asetof
samplescripts,andafunctionlibraryformanagementand
automation.ThevSphereImageBuilderPowerCLIandthe
vSphereAutoDeployPowerCLIareincludedwhenyouinstall
thevSpherePowerCLI.
localclicommands
SetofcommandsforusewithVMwareTechnicalSupport.
localclicommandsareequivalenttoESXCLIcommands,but
bypasshostd.Thelocalclicommandsareonlyforsituations
whenhostdisunavailableandcannotberestarted.Afteryourun
alocalclicommand,youmustrestarthostd.RunESXCLI
commandsaftertherestart.
Ifyouusealocalclicommandinothersituations,an
inconsistentsystemstateandpotentialfailurecanresult.
InstallthevCLIcommandsetontheWindowsorLinuxsystemfromwhichyouwanttoadministeryour
ESXisystemsandrunvCLIcommands.SeeInstallingvCLIonpage 13.
DeployavMAvirtualmachinetoanESXisystemandrunvCLIcommandsfromthere.
AfteryouhaveinstalledthevCLIpackageyoucanrunthecommandsinthesetagainstESXihosts.Youmust
specifyconnectionparameterswhenyourunavCLIcommand.SeeUsingthevSphereCommandLine
Interfaceonpage 23.
Using ESXCLI
YoucanmanagemanyaspectsofanESXihostwiththeESXCLIcommandset.YoucanrunESXCLIcommands
asvCLIcommandsorrunthemintheESXiShellintroubleshootingsituations.
YoucanalsorunESXCLIcommandsfromthePowerCLIshellbyusingtheGet-EsxClicmdlet.SeethevSphere
PowerCLIAdministrationGuideandthevSpherePowerCLIReference.
ThesetofESXCLIcommandsavailableonahostdependsonthehostconfiguration.ThevSphere
CommandLineInterfaceReferencelistshelpinformationforallESXCLIcommands.Runesxcli --server
<MyESXi> --helpbeforeyourunacommandonahosttoverifythatthecommandisdefinedonthehostyou
aretargeting.
ESXCLI Syntax
EachESXCLI5commandusesthesamesyntax.
esxcli [dispatcher options] <namespace> [<namespace> ...] <cmd> [cmd options]
dispatcheroptions.Predefinedoptionsforconnectioninformationsuchastargethost,username,andso
on.SeeCommonOptionsforvCLIExecutiononpage 27.Notrequiredwhenyourunthecommandin
theESXiShell.
namespace.GroupsESXCLIcommands.vSphere5.0supportsnestednamespaces.
VMware, Inc.
command.Reportsonormodifiesstateonthesystem.
DeploythevMAapplianceonanESXisystemandauthenticateagainstasetoftargetservers.Youcan
thenrunESXCLIcommandsagainstanytargetserverbyspecifyingthe--hostdispatcheroption.No
additionalauthenticationisrequired.SeethevSphereManagementAssistantGuide.
InstallthevCLIpackageononeofthesupportedWindowsorLinuxsystems.TheESXCLIcommandset
isincluded.YoucanruncommandsagainstanESXiorvCenterServersystemifyouspecifyconnection
options.SeeInstallingvCLIonpage 13.
Command Syntax
Afterinstallation,runESXCLIcommandsagainstaspecifichostbyfirstspecifyingalldispatcheroptions.If
thetargetserverisavCenterServersystem,specifythetargetESXihostbeforeanyESXCLInamespaces,
commands,andsupportedoptions.
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
Eachtimeyourunacommand,youmustspecifyauthenticationinformation.SeeUsingthevSphere
CommandLineInterfaceonpage 23.
IfyouruncommandsagainstESXi4.xhosts,ESXCLI4.xcommandsaresupported.
IfyouruncommandsagainstESXi5.0hosts,ESXCLI5.0commandsaresupported.ESXCLI5.1
commandsthatwereincludedinESXCLI5.0arealsosupported.
IfyouruncommandsagainstESXi5.1hosts,ESXCLI5.1andESXCLI5.0commandsaresupported.
VMwarepartnersmightdevelopcustomESXCLIcommandsthatyoucanrunonhostswherethepartnerVIB
hasbeeninstalled.
Runesxcli --server <target> --helpforalistofnamespacessupportedonthetarget.Youcandrill
downintothenamespacesforadditionalhelp.
IMPORTANTESXCLIonESX4.xhostsdoesnotsupporttargetingavCenterServersystem.Youcantherefore
notruncommandswith--serverpointingtoavCenterServersystemevenifyouinstallvCLI5.0orvCLI5.1.
Logintotheshell.
Runthecommand.Forexample,tolistNASstoragedevices,runthefollowingcommand.
esxcli storage nfs list
Youcanuse--helpatanylevelofesxcliforhelponavailablenamespaces,commands,oroptions.
VMware, Inc.
LocalshellaccessallowsyoutologintotheshelldirectlyfromtheDirectConsole.SeeEnablingLocal
ESXiShellAccessonpage 10.
Remoteshell(SSH)accessallowsyoutoconnecttothehostusingashellsuchasPuTTY,specifyauser
nameandpassword,andruncommandsintheshell.
TheESXiShellincludesallESXCLIcommands,asetofdeprecatedesxcfg-commands,andasetof
commandsfortroubleshootingandremediation.
IMPORTANTAllESXCLIcommandsthatareavailableintheESXiShellarealsoincludedinthevCLIpackage.
VMwarerecommendsyouinstallthevCLIpackageonasupportedWindowsorLinuxsystemordeploythe
vMAvirtualappliance,andruncommandsagainstyourESXihosts.RuncommandsdirectlyintheESXiShell
introubleshootingsituationsonly.
AtthedirectconsoleoftheESXihost,pressF2andprovidecredentialswhenprompted.
ScrolltoTroubleshootingOptionsandpressEnter.
ChooseEnableESXiShellandpressEnter.
Ontheleft,EnableESXiShellchangestoDisableESXiShell.Ontheright,ESXiShellisDisabled
changestoESXiShellisEnabled.
PressEscuntilyoureturntothemaindirectconsolescreen.
Ifyoudonothaveaccesstothedirectconsole,youcanenabletheESXiShellfromthevSphereClient.
To enable the local or remote ESXi Shell from the vSphere Client
1
Selectthehost,clicktheConfigurationtab,andclickSecurityProfileintheSoftwarepanel.
IntheServicessection,clickProperties.
SelectESXiShellandclickOptions.
ChangetheESXiShelloptions.
TochangetheStartuppolicyacrossreboots,clickStartandstopwithhostandrebootthehost.
Totemporarilystartorstoptheservice,clicktheStartorStopbutton.
ClickOK.
AfteryouhaveenabledtheESXiShell,youcanuseitfromthatmonitororthroughaserialport.
TheESXiShelltimeoutsettingspecifieshowlong,inminutes,youcanleaveanunusedsessionopen.By
default,thetimeoutfortheESXiShellis0,whichmeansthesessionremainsopenevenifitisunused.Ifyou
changethetimeout,forexample,to30minutes,youhavetologinagainafterthetimeoutperiodhaselapsed.
NOTEIfyouareloggedinwhenthetimeoutperiodelapses,yoursessionwillpersist.However,theESXiShell
willbedisabled,preventingotherusersfromloggingin.
10
VMware, Inc.
YoucanmodifythetimeoutfromtheDirectConsoleorfromthevSphereClient.
To modify the ESXi Shell Timeout
IntheDirectConsole,followthesesteps.
a
SelectModifyESXiShelltimeoutandpressEnter.
EnterthetimeoutvalueinminutesandpressEnter.
InthevSphereClient,followthesesteps.
a
IntheConfigurationtabsSoftwarepanel,clickAdvancedSettings.
Intheleftpanel,clickUserVars.
LocateUserVars.ESXiShellTimeOutandenterthetimeoutvalueinminutes.
ClickOK.
Atthemaindirectconsolescreen,pressAltF1toopenavirtualconsolewindowtothehost.
Providecredentialswhenprompted.
Whenyoutypethepassword,charactersarenotdisplayedontheconsole.
Entershellcommandstoperformmanagementtasks.
Tologout,typeexitintheshell.
Toreturntothedirectconsole,typeAltF2.
SeevSphereInstallationandSetupdocumentationforinformationonserialportsetup.
AtthedirectconsoleoftheESXihost,pressF2andprovidecredentialswhenprompted.
ScrolltoTroubleshootingOptionsandpressEnter.
ChooseEnableSSHandpressEnteronce.
Ontheleft,EnableSSHchangestoDisableSSH.Ontheright,SSHisDisabledchangestoSSHis
Enabled.
PressEscuntilyoureturntothemaindirectconsolescreen.
SelectthehostandclicktheConfigurationtab.
ClickSecurityProfileintheSoftwarepanel.
VMware, Inc.
11
IntheServicessection,clickProperties.
SelectSSHandclickOptions.
ChangetheSSHoptions.
TochangetheStartuppolicyacrossreboots,clickStartandstopwithhostandrebootthehost.
Totemporarilystartorstoptheservice,clicktheStartorStopbutton.
ClickOK.
AfteryouhaveenabledSSH,youlogintotheESXiShellremotelyandrunESXiShellcommands.
OpenanSSHclient.
SpecifytheIPaddressordomainnameoftheESXihost.
PrecisedirectionsvarydependingontheSSHclientthatyouareusing.Seevendordocumentationand
support.
12
Providecredentialswhenprompted.
VMware, Inc.
Installing vCLI
YoucaninstallavCLIpackageonaLinuxoraMicrosoftWindowssystem,ordeploythevSphere
ManagementAssistant(vMA)onanESXihost.
Thischapterincludesthefollowingtopics:
InstallationOverviewonpage 13
OverviewofLinuxInstallationProcessonpage 14
InstallingthevCLIPackageonRedHatEnterpriseLinuxonpage 16
InstallingvCLIonLinuxSystemswithInternetAccessonpage 17
RunningCommandsonLinuxonpage 19
UninstallingthevCLIPackageonLinuxonpage 19
InstallingandUninstallingvCLIonWindowsonpage 19
RunningCommandsonWindowsonpage 20
EnablingCertificateVerificationonpage 21
DeployingvMAonpage 21
Installation Overview
YoucaninstallavCLIpackageonasupportedplatformordeploythevMAvirtualmachineonanESXihost.
vCLIpackages.InstallavCLIpackageonaphysicalorvirtualmachine.SeeInstallingthevCLIPackage
onRedHatEnterpriseLinuxonpage 16,InstallingvCLIonLinuxSystemswithInternetAccesson
page 17,andInstallingandUninstallingvCLIonWindowsonpage 19.
ThevCLIinstallerinstallsbothvSphereSDKforPerlandvCLIbecausevCLIcommandsrunontopofthe
vSphereSDKforPerl.Thecontentsoftheinstallerpackagediffersfordifferentplatforms.
Platform
Installation Process
Windows
TheinstallationpackageincludesvCLI,vSphereSDKforPerl,andprerequisitePerl
modules.
RedHatEnterprise
Linux
Youmustinstallrequiredsoftware.SeeInstallingRequiredPrerequisiteSoftwareforRed
HatEnterpriseLinuxonpage 16.
IfyouhaveInternetaccess,RHELdownloadsPerlmodulesfromCPAN.
IfyoudonothaveInternetaccess,theinstallerinstallsPerlmodulesthatitdoesnotfind
onyoursystemfromtheinstallerpackage.
SLESandUbuntu
YoumustinstallrequiredsoftwareandyoumusthaveInternetaccess.SeeInstalling
RequiredPrerequisiteSoftwareforLinuxSystemswithInternetAccessonpage 17.
TheinstallerdownloadsotherPerlmodulesfromCPAN.
VMware, Inc.
13
Afterinstallation,youcanrunvCLIcommandsandvSphereSDKforPerlutilityapplicationsfromthe
operatingsystemcommandline.Eachtimeyourunacommand,youspecifythetargetserverconnection
optionsdirectlyorindirectly.YoucanalsowritescriptsandmanageyourvSphereenvironmentusing
thosescripts.
vMA.DeployvMA,avirtualmachinethatadministratorscanusetorunscriptsthatmanagevSphere,on
anESXihost.vMAincludesvCLI,vSphereSDKforPerl,andotherprepackagedsoftwareinaLinux
environment.
vMAsupportsnoninteractivelogin.IfyouestablishanESXihostasatargetserver,youcanrunvCLIand
vSphereSDKforPerlcommandsagainstthatserverwithoutadditionalauthentication.Ifyouestablisha
vCenterServersystemasatargetserver,youcanrunmostvCLIcommandsagainstallESXisystemsthat
servermanageswithoutadditionalauthentication.SeeDeployingvMAonpage 21.
RedHatEnterpriseLinux5.5Server(32bitand64bit)
SLES10SP1(32bitand64bit)
SLES11(32bitand64bit)
SLES11SP1(32bitand64bit)
Ubuntu10.04(32bitand64bit)
ThevCLIpackageinstallerinstallsthevCLIscriptsandthevSphereSDKforPerl.Theinstallationproceedsas
follows.
1
Theinstallercheckswhetherthefollowingrequiredprerequisitepackagesareinstalledonthesystem:
Perl
Perlversion5.8.8orversion5.10mustbeinstalledonyoursystem.
OpenSSL
ThevCLIrequiresSSLbecausemostconnectionsbetweenthesystemonwhichyourunthecommand
andthetargetvSpheresystemareencryptedwithSSL.
TheOpenSSLlibrary(libssl-devpackage)isnotincludedinthedefaultLinuxdistribution.See
InstallingRequiredPrerequisiteSoftwareforRedHatEnterpriseLinuxonpage 16andInstalling
RequiredPrerequisiteSoftwareforLinuxSystemswithInternetAccessonpage 17.
LibXML2
UsedforXMLparsing.ThevCLIclientrequires2.6.26orhigherversion.Ifyouhaveanolderversion
installed,pleaseupgradeto2.6.26orhigher.
Thelibxml2packageisnotincludedinthedefaultLinuxdistribution.SeeInstallingRequired
PrerequisiteSoftwareforRedHatEnterpriseLinuxonpage 16andInstallingRequiredPrerequisite
SoftwareforLinuxSystemswithInternetAccessonpage 17.
uuid
14
Includedinuuid-devforSLES11andine2fsprogsforotherLinuxplatforms.RequiredbytheUUID
Perlmodule.
Iftherequiredsoftwareisfound,theinstallerproceeds.Otherwise,theinstallerstopsandinformsyou
thatyoumustinstallthesoftware.SeeInstallingRequiredPrerequisiteSoftwareforRedHatEnterprise
Linuxonpage 16andInstallingRequiredPrerequisiteSoftwareforLinuxSystemswithInternet
Accessonpage 17forinstructions.
TheinstallercheckswhetherthefollowingPerlmodulesarefound,andwhetherthecorrectversionis
installed.
CryptSSLeay0.55(0.550.9.7or0.550.9.8)
IOCompressBase2.037
CompressZlib2.037
IOCompressZlib2.037
CompressRawZlib2.037
ArchiveZip1.28
DataDumper2.121
VMware, Inc.
XMLLibXML1.63
libwwwperl5.805
LWPProtocolhttps6.02
XMLLibXMLCommon0.13
XMLNamespaceSupport1.09
XMLSAX0.16
DataDump1.15
URI1.37
UUID0.03
SOAPLite0.710.08
HTMLParser3.60
version0.78
ClassMethodMaker2.10
EarlierversionsoflibwwwperlincludetheLWPProtocolhttpsmodule.Veryrecentversionsof
libwwwperldonotincludetheLWPProtocolhttpsmoduleandyouhavetoinstallthatmodule.
NOTEIfyouintendtorunvCLIcommandswithSSLcertification,besuretocheckthatLWP::UserAgent
6.00orlaterisinstalled.Theinstallerdoesnotcheckthismodule,andearlierversionsdonotworkwith
SSL.
4
TheinstallerproceedsdependingontheLinuxdistribution.
Linux distribution
Installer behavior
RHEL(NoInternet
access)
OnRHEL,theinstallerallowsyoutoinstallPerlmoduleswithCPANifInternetaccessis
available.
IfnoInternetaccessisavailable,andifarecommendedPerlmoduleisnotfoundatall,the
installerinstallsit.Ifadifferentversionofthemoduleisfound,theinstallerdoesnotinstall
itandproceedswiththeinstallationprocess.Attheendoftheinstallationprocess,the
installerinformsyouiftheversiononthesystemdoesnotmatchtherecommended
version,andrecommendsthatyouinstalltheversionvCLIwastestedwith.Youcaninstall
themodulesusingthepackageinstallerforyourplatform,theinstallationCD,orCPAN.
Note:TheinstallerdoesnotoverwriteexistingversionsofrecommendedPerlmodules.
Youmustexplicitlyupdatethosemodulesyourself.
AllLinux
distributions
(Internetaccess)
TheinstallerproceedsdependingonwhetherthePerlmodulesarefound.
IfarecommendedPerlmoduleisnotfoundatall,theinstallerinstallsitusingCPAN.
YoumustmeettheinstallationprerequisitesortheinstallercannotinstallthePerl
modulesandstops.SeeInstallingvCLIonLinuxSystemswithInternetAccesson
page 17.
Ifalowerversionofarecommendedmoduleisfound,theinstallerdoesnotinstalla
differentversionfromCPANandproceedswithinstallation.Aftercompleting
installation,theinstallerdisplaysamessagethattheversiononthesystemdoesnot
matchtherecommendedversion,andrecommendsthatyouinstalltheversionvCLI
wastestedwith.Youcaninstallthemodulesusingthepackageinstallerforyour
platform,theinstallationCD,orCPAN.
Ifahigherversionofarecommendedmoduleisfound,theinstallerproceedswith
installationanddoesnotdisplayamessageafterinstallation.
Note:TheinstallerdoesnotoverwriteexistingversionsofrecommendedPerlmodules.
Youmustexplicitlyupdatethosemodulesyourself.
AfterallrequiredsoftwareandallprerequisitePerlmodulesareinstalled,youcaninstallvCLI.See
InstallingthevCLIPackageonRedHatEnterpriseLinuxonpage 16andInstallingthevCLIPackage
onaLinuxSystemwithInternetAccessonpage 18.
IfapreviousversionofvCLI,RemoteCLI,orvSphereSDKforPerlisinstalledonyoursystem,andyouinstall
vCLIinadifferentdirectory,youmustresetthePATHenvironmentvariable.Youcandosobeforeorafterthe
installation,usingthecommandappropriateforyourdistributionandshell(setenv,export,andsoon).If
youdonotresetthepath,thesystemmightstilllookforexecutablesintheoldlocation.
VMware, Inc.
15
Installrequiredprerequisitesoftware.SeeInstallingRequiredPrerequisiteSoftwareforRedHat
EnterpriseLinuxonpage 16.
Whenprompted,directtheinstallertoinstalladditionalprerequisitesfromtheinstallationpackage(see
InstallingthevCLIPackageonRHEL(NoInternetAccess)onpage 16)orfromCPAN(seeInstalling
thevCLIPackageonaLinuxSystemwithInternetAccessonpage 18)
Runtheuninstallscript,forexample,ifyouinstalledvCLIinthedefaultlocation,runthefollowing
command:
/usr/bin/vmware-uninstall-vSphere-CLI.pl
DeleteexistingversionsofvSphere-CLI.xxxx.tar.gzanddeletethevmware-vsphere-cli-distrib
directory.
UntarthevCLIbinarythatyoudownloaded.
tar zxvf VMware-vSphere-CLI-5.X.X-XXXXX.i386.tar.gz
Avmware-vsphere-vcli-distribdirectoryiscreated.
2
Loginassuperuserandruntheinstaller:
/<location>/sudo vmware-vsphere-cli-distrib/vmware-install.pl
16
Toacceptthelicenseterms,typeyesandpressEnter.
ToinstallPerlmoduleslocally,typeyesandpressEnter.
Specifyaninstallationdirectory,orpressEntertoacceptthedefault,whichis/usr/bin.
VMware, Inc.
Acompleteinstallationprocesshasthefollowingresult:
Asuccessmessageappears.
Theinstallerlistsdifferentversionnumbersforrequiredmodules(ifany).
Thepromptreturnstotheshellprompt.
Ifyouacceptedthedefaultsduringinstallation,youcanfindtheinstalledsoftwareinthefollowinglocations:
vCLIscripts/usr/bin
vSphereSDKforPerlutilityapplications/usr/lib/vmware-vcli/apps
vSphereSDKforPerlsamplescripts/usr/share/doc/vmware-vcli/samples
SeethevSphereSDKforPerldocumentationforareferencetoallutilityapplications.
AfteryouinstallthevCLI,youcantesttheinstallationbyrunningacommandfromthecommandprompt.See
RunningCommandsonLinuxonpage 19.
Internetaccess.YoumusthaveInternetaccesswhenyouruntheinstallerbecausetheinstallerusesCPAN
toinstallprerequisitePerlmodules.
DevelopmentToolsandLibraries.YoumustinstalltheDevelopmentToolsandLibrariesfortheLinux
platformthatyouareworkingwithbeforeyouinstallvCLIandprerequisitePerlmodules.
Proxysettings.IfyoursystemisusingaproxyforInternetaccess,youmustsetthehttp://andftp://
proxies,asfollows:
export http_proxy=<proxy_server>:port
export ftp_proxy=<proxy_server>:port
Installation
RHEL5.5,32bit
RHEL5.5,64bit
Installprerequisitesusingyum,theRHELpackageinstaller(recommended),orfromthe
installationDVD.Forexample:
yum install openssl-devel libxml2-dev e2fsprogs-dev
SLES10,32bit
SLES10,64bit
InstalltheprerequisitepackagesfromtheSLES10andSLES11SDKDVD.Whenyouinsertthe
DVD,itofferstoautorun.Canceltheautorundialogboxandusetheyastpackageinstallerto
installOpenSSLorothermissingrequiredpackages.
SomeusersmightbeauthorizedtousetheNovellCustomerCenteranduseyasttoretrieve
missingpackagesfromthere.
NotethatSLES10includeslibxml2version2.6.23.ThevCLIclientrequire2.6.26orhigher.
Upgradeto2.6.26orhigher.
VMware, Inc.
17
Installation
SLES11,32bit
InstalltheprerequisitepackagesfromtheSLES10andSLES11SDKDVD.Whenyouinsertthe
DVD,itofferstoautorun.Canceltheautorundialogboxandusetheyastpackageinstallerto
installOpenSSLorothermissingrequiredpackages.
SLES11SP1,32bit
SLES11,64bit
SLES11SP1,64bit
SomeusersmightbeauthorizedtousetheNovellCustomerCenteranduseyasttoretrieve
missingpackagesfromthere.
Ubuntu10.04,32bit
1.ConnecttotheInternet.
Ubuntu10.04,64bit
2.Updatethelocalrepositoryoflibrariesfromaterminalwindow.
sudo apt-get update
3.Installtherequiredlibrariesfromaterminalwindow.
ForUbuntu10.0464bit,youmustinstallthe32bitcompatibilitylibrariesortheresxtopand
ESXCLIcommandsdonotwork.
Loginasroot.
UntarthevCLIbinarythatyoudownloaded.
tar zxvf VMware-vSphere-CLI-5.X.X-XXXXX.i386.tar.gz
Avmware-vsphere-vcli-distribdirectoryiscreated.
3
(Optional)IfyourserverusesaproxytoaccesstheInternet,andifyourhttp://andftp://proxywere
notsetwhenyouinstalledprerequisitesoftware,setthemnow.
export http_proxy=<proxy_server>:port
export ftp_proxy=<proxy_server>:port
Runtheinstaller:
sudo vmware-vsphere-cli-distrib/vmware-install.pl
Toacceptthelicenseterms,typeyesandpressEnter.
TheinstallerconnectstoCPANandinstallsprerequisitesoftware.Establishingaconnectionmighttakea
longtime.
OnRHEL,whenpromptedtoinstallprecompiledPerlmodules,typenoandpressEntertouseCPAN
TheinstallerconnectstoCPANandinstallsprerequisitesoftware.Establishingaconnectionmighttakea
longtime.
Specifyaninstallationdirectory,orpressEntertoacceptthedefault,whichis/usr/bin.
Acompleteinstallationprocesshasthefollowingresult:
Asuccessmessageappears.
Theinstallerlistsdifferentversionnumbersforrequiredmodules(ifany).
Thepromptreturnstotheshellprompt.
Ifyouacceptedthedefaultsduringinstallation,youcanfindtheinstalledsoftwareinthefollowinglocations:
18
vCLIscripts/usr/bin
VMware, Inc.
vSphereSDKforPerlutilityapplications/usr/lib/vmware-vcli/apps
vSphereSDKforPerlsamplescripts/usr/share/doc/vmware-vcli/samples
SeethevSphereSDKforPerldocumentationforareferencetoallutilityapplications.AfteryouinstallvCLI,
youcantesttheinstallationbyrunningavCLIcommandorvSphereSDKforPerlutilityapplicationfromthe
commandprompt.
Openacommandprompt.
(Optional)ChangetothedirectorywhereyouinstalledthevCLI(defaultis/usr/bin).
Runthecommand,includingtheconnectionoptions.
<command> <conn_options> <params>
Specifyconnectionoptionsinaconfigurationfileorpassthemonthecommandline.Theextension.pl
isnotrequiredonLinux.Forexample:
esxcli --server <server> --username snow\-white --password dwarf\$ network ip interface list
vicfg-mpath --server <server> --username snow\-white --password dwarf\$ --list
Thesystempromptsyouforausernameandpasswordforthetargetserver.
SeeTable 32,vCLIConnectionOptions,onpage 28foracompletelistofconnectionoptions.
ChangetothedirectorywhereyouinstalledvCLI(defaultis/usr/bin).
Runthevmware-uninstall-vSphere-CLI.pl script.
ThecommanduninstallsvCLIandthevSphereSDKforPerl.
WindowsVistaEnterpriseSP132bitand64bit
Windows200864bit
Windows732bitand64bit
IMPORTANTIfyouwanttorunESXCLIcommandsincludedinvCLIfromaWindowssystem,youmusthave
theVisualC++2008redistributablefor32bitinstalledonthatsystem.Findvcredist_x86.exeforVisualC++
2008andinstallitonyourWindowssystem.
To install the vCLI Package on Windows
1
DownloadthevCLIWindowsinstallerpackage.
YoucanfindtheinstallerontheVMwareCommunitiespage.
VMware, Inc.
19
Starttheinstaller.
(Optional)IfpromptedtoremoveolderversionsofvSphereSDKforPerlorvCLI,youcaneitheraccept
orcanceltheinstallationandinstallthevCLIpackageonadifferentsystem.
IMPORTANTTheinstallerreplacesboththevSphereSDKforPerlandvCLI.Tokeepanolderversion,
installthispackageonadifferentsystem.
ClickNextintheWelcomepage.
ToinstallthevCLIinanondefaultdirectory,clickChangeandselectthedirectory.
ThedefaultlocationisC:\Program Files\VMware\VMware vSphere CLI.
ClickNext.
ClickInstalltoproceedwiththeinstallation.
Theinstallationmighttakeseveralminutestocomplete.
Rebootyoursystem.
Withoutreboot,pathsettingsmightnotbecorrectonyourWindowsplatform.
FromtheWindowsStartmenu,choosePrograms>VMware>VMwarevSphereCLI>Command
Prompt.
AcommandpromptshellforthelocationwherevCLIisinstalledappears.YouhaveeasyaccesstovCLI
andtovSphereSDKforPerlcommandsfromthatlocation.
Runthecommand,passinginconnectionoptionsandotheroptions.
OnWindows,theextension.plisrequiredforvicfg-commands,butnotforESXCLI.
<command>.pl <conn_options> <params>
Forexample:
esxcli --server <server> --username snow-white --password dwarf$ network ip interface list
vicfg-mpath.pl --server <server> --username snow-white --password dwarf$ --list
Thesystempromptsyouforausernameandpassword.
SeeTable 32,vCLIConnectionOptions,onpage 28foracompletelistofconnectionoptions.
FindtheoptionforaddingandremovingprogramsontheWindowsoperatingsystemyouareusing.
Inthepanelthatappears,selectVMwarevSphereCLI,andclickRemove.
ClickYeswhenprompted.
ThesystemuninstallsthevSphereSDKforPerl,thevCLI,andallprerequisitesoftware.
20
VMware, Inc.
HTTPS_CA_FILETheCAfile.
HTTPS_CA_DIRTheCAdirectory.
SeetheCrypt::SSLEaydocumentationfordetailsonsetup.
CAUTIONIfthetwoenvironmentvariablesHTTPS_CA_FILEandHTTPS_CA_DIRaresetincorrectlyorifa
problemwiththecertificateexists,vCLIcommandsdonotcomplete,anddonotprinterrororwarning
messages.UseHTTPS_DEBUGfortroubleshootingbeforerunningvCLIcommands.
Deploying vMA
Asanalternativetoapackageinstallation,youcandeployvMAonanESXihostandrunvCLIcommandsfrom
there.vMAisavirtualmachineyoucanusetorunscriptstomanageESXisystems.vMAincludesaLinux
environment,vCLI,andotherprepackagedsoftware.
SettingupvMAconsistsofafewtasks.ThevSphereManagementAssistantGuidediscusseseachtaskindetail.
1
DeployvMAtoanESXisystemthatmeetsthehardwareprerequisites.
SeethevSphereManagementAssistantGuideforprerequisitesanddeploymentdetails.
ConfigurevMA.
WhenyoubootvMA,youmustspecifythefollowingrequiredconfigurationinformationwhen
prompted:
Networkinformation(thedefaultisoftenacceptable)
HostnameforvMA.
Passwordfortheviadminuser.TheviadminuserhassuperuserprivilegesonvMA.Youcannotlog
intovMAastherootuser.
(Optional)AddavCenterServersystemoroneormoreESXisystemsastargets.YouconfigurevMAfor
ActiveDirectoryauthenticationandcanthenaddESXiandvCenterServersystemstovMAwithout
havingtostorepasswordsinthevMAcredentialstore.SeethevSphereManagementAssistantGuide.
VMware, Inc.
21
22
VMware, Inc.
3f
YoucanrunvSphereCommandLineInterface(vCLI)commandsfromthecommandlineofthesystemwhere
youinstalledthepackage,fromthevMAcommandline,andfromscripts.Eachcommandrequiresata
minimumthetargetservertorunthecommandon.Usersauthorizedtoruncommandsonthetargetserver
donothavetospecifyauthenticationinformation.Otherusersmustspecifyauthenticationinformation.
Thischapterincludesthefollowingtopics:
OverviewofRunningCommandsonpage 23
SpecifyingAuthenticationInformationonpage 24
CommonOptionsforvCLIExecutiononpage 27
UsingvCLICommandsinScriptsonpage 29
IMPORTANTIfanESXisystemthatyoutargetisinlockdownmode,youcannotrunvCLIcommandsagainst
thatsystemdirectly.YoumusttargetavCenterServersystemthatmanagestheESXisystemandusethe
--vihostoptiontospecifytheESXitarget.SeevCLIandLockdownModeonpage 27.
OpenacommandpromptonaLinuxorWindowssystemonwhichyouinstalledvCLI.Entercommands
intothatcommandprompt,specifyingconnectionoptions.
AccessthevMALinuxconsole.SetuptargetserversandrunvCLIcommandsagainstthetargetswithout
additionalauthentication.
PreparescriptsthatcontainvCLIcommands.Thenrunthescriptsfromaremoteadministrationserver
thathasthevCLIpackageinstalledorfromthevMALinuxconsole.SeeUsingvCLICommandsin
Scriptsonpage 29.
WhenyouruncommandsagainstanESXihost,youmustbeauthenticatedforthathost.Whenyourun
commandsagainstavCenterServersystem,andyouareauthenticatedforthatsystem,youcantargetallESXi
hoststhatvCenterServermanageswithoutadditionalauthentication.SeeSpecifyingAuthentication
Informationonpage 24.
CAUTIONIfyouspecifypasswordsinplaintext,youriskexposingthepasswordtootherusers.Thepassword
mightalsobecomeexposedinbackupfiles.Donotprovideplaintextpasswordsonproductionsystems.
VMware, Inc.
23
Followoneofthefollowingapproachesforprotectingpasswords.
IfyouuseavCLIcommandinteractivelyanddonotspecifyausernameandpassword,youareprompted
forthem.Thescreendoesnotechothepasswordyoutype.
Fornoninteractiveuse,youcancreateasessionfileusingthesave_sessionscriptincludedinthe
apps/sessiondirectory.SeeUsingaSessionFileonpage 24.
IfyouarerunningonaWindowssystem,youcanusethe--passthroughauthoption.Iftheuserwho
runsthecommandwiththatoptionisknown,nopasswordisrequired.
IfyouarerunningvMA,youcansetuptargetserversandrunmostvCLIcommandsagainsttargetservers
withoutadditionalauthentication.SeethevSphereManagementAssistantGuide.
Description
See
Commandline
Password(--password),sessionfile
(--sessionfile),orconfigurationfile
(--config)specifiedonthecommandline.
UsingaSessionFileonpage 24
Environment
variable
Passwordspecifiedinanenvironmentvariable.
UsingEnvironmentVariablesonpage 25
Configurationfile
Passwordspecifiedinaconfigurationfile.
UsingaConfigurationFileonpage 25
Currentaccount
(ActiveDirectory)
Currentaccountinformationusedtoestablish
anSSPIconnection.AvailableonlyonWindows.
UsingMicrosoftWindowsSecuritySupport
ProviderInterfaceonpage 27
Credentialstore
Passwordretrievedfromthecredentialstore.
vSphereWebServicesSDKProgrammingGuide
andvSphereSDKforPerlProgrammingGuide.
Prompttheuserfor
apassword.
Passwordisnotechoedtoscreen.
24
VMware, Inc.
Connecttothedirectorywherethescriptislocated.
Forexample:
Windows:
Linux:
cd /usr/share/lib/vmware-vcli/apps/session
Runsave_session.
Youcanusethesave_session.plscriptorthe--savesessionfileoptiontothevCLIcommand.You
mustspecifytheservertoconnecttoandthenameofasessionfileinwhichthescriptsavesan
authenticationcookie.
save_session --savesessionfile <location> --server <server>
Forexample:
Windows:
Linux:
Ifyouspecifyaserver,butnousernameorpassword,thescriptpromptsyou.
3
WhenyourunvCLIcommands,passinthesessionfileusingthe--sessionfileoption.
<command> --sessionfile <sessionfile_location> <command_options>
Forexample:
Windows:
Linux:
OnWindows,youcansetenvironmentvariablesintheEnvironmentpropertiesdialogboxoftheSystem
controlpanel.Forthecurrentsession,youcansetenvironmentvariablesatthecommandlinebyusinga
commandlikethefollowing:
set VI_SERVER=<your_server_name_or_address>
IMPORTANTDonotuseescapecharactersinenvironmentvariables.
SeeUsingvCLICommandsinScriptsonpage 29foranenvironmentvariableexample.
VMware, Inc.
25
PassintheconfigurationfilewhenyourunvCLIcommands,asfollows:
<command> --config <my_saved_config> <option>
Forexample:
esxcli --config <my_saved_config> network ip interface list
vicfg-mpath --config <my_saved_config> --list
IfyouhavemultiplevCenterServerorESXisystemsandyouadministereachsystemindividually,youcan
createmultipleconfigurationfileswithdifferentnames.Torunacommandorasetofcommandsonaserver,
youpassinthe--configoptionwiththeappropriatefilenameatthecommandline.
Thefollowingexampleillustratesthecontentsofaconfigurationfile:
VI_SERVER = XX.XXX.XXX.XX
VI_USERNAME = root
VI_PASSWORD = my_password
VI_PROTOCOL = https
VI_PORTNUMBER = 443
Ifyouhavesetupyoursystemtorunthisfile,youcanrunscriptsonthespecifiedserverafterwards.
ForothervCLIcommands,uselongorshortoptions.Anequalsignisnotsupported.
<vicfg- command> --server <vc_server> --username <privileged_user> --password <pw>
--vihost <esx_host> --<option_name option_value>
Someoptions,suchas--help,havenovalue.
IMPORTANTEnclosepasswordsandothertextwithspecialcharactersinquotationmarks.
WhenrunningcommandsonWindows,usedoublequotes( ).WhenrunningcommandsonLinux,use
singlequotes( )orabackslash(\)asanescapecharacter.
Thefollowingexamplesconnecttotheserverasusersnow-whitewithpassworddwarf$.
Linux
esxcli --server <server> --username snow\-white --password dwarf\$ network ip interface list
esxcli --server <server> --username snow\-white --password dwarf$ network ip interface list
vicfg-mpath --server <server> --username snow\-white --password dwarf\$ --list
vicfg-mpath --server <server> --username snow-white --password dwarf$ --list
Windows
esxcli --server <server> --username snow-white --password dwarf$ network ip interface list
vicfg-mpath.pl --server <server> --username snow-white --password dwarf$ --list
26
VMware, Inc.
ConnectstoaserverthatissetuptouseSSPI.Whenatrusteduserrunsthecommand,thesystemcallsthe
ESXCLIcommandorvicfg-mpathwiththe--listoption.Thesystemdoesnotpromptforausernameand
password.
vicfg-snmp
vifs
vicfg-user
vicfg-cfgbackup
vihostupdate
vmkfstools
vicfg-ipsec
IfyouhaveproblemsrunningacommandonanESXihostdirectly(withoutspecifyingavCenterServer
target),checkwhetherlockdownmodeisenabledonthathost.SeethevSphereSecuritydocumentation.
27
SeeTorunavCLIcommandonLinuxonpage 19andTorunavCLIcommandonWindowsonpage 20
forusageexamples.
Table 3-2. vCLI Connection Options
Option and Environment Variable
Description
--cacertsfile <certsfile>
ESXCLIcommandsonly.
-t <certs_file>
VI_CACERTFILE=<cert_file_path>
UsedtospecifytheCA(CertificateAuthority)certificatefile,inPEMformat,
toverifytheidentityofthevCenterServersystemorESXisystemtorunthe
commandon.Canbeused,forexample,topreventmaninthemiddleattacks.
--config <cfg_file_full_path>
Usestheconfigurationfileatthespecifiedlocation.
VI_CONFIG=<cfg_file_full_path>
Specifyapaththatisreadablefromthecurrentdirectory.
--credstore <credstore>
Nameofacredentialstorefile.Defaultsto
<HOME>/.vmware/credstore/vicredentials.xmlonLinuxand
<APPDATA>/VMware/credstore/vicredentials.xmlonWindows.
CommandsforsettingupthecredentialstoreareincludedinthevSphereSDK
forPerl,whichisinstalledwithvCLI.ThevSphereSDKforPerlProgramming
Guideexplainshowtomanagethecredentialstore.
--encoding <encoding>
Specifiestheencodingtobeused.Severalencodingsaresupported.
VI_ENCODING=<encoding>
cp936(SimplifiedChinese)
shftjis(Japanese)
cp850(GermanandFrench).
Youcanuse--encodingtospecifytheencodingvCLIshouldmaptowhenit
isrunonaforeignlanguagesystem.
--passthroughauth
VI_PASSTHROUGHAUTH
Ifyouspecifythisoption,thesystemusestheMicrosoftWindowsSecurity
SupportProviderInterface(SSPI)forauthentication.Trustedusersarenot
promptedforausernameandpassword.SeetheMicrosoftWebsitefora
detaileddiscussionofSSPI.
ThisoptionissupportedonlyifyouarerunningvCLIonaWindowssystem
andareconnectingtoavCenterServersystem.
--passthroughauthpackage
<package>
VI_PASSTHROUGHAUTHPACKAGE=
<package>
Usethisoptionwith--passthroughauthtospecifyadomainlevel
authenticationprotocoltobeusedbyWindows.Bydefault,SSPIusesthe
Negotiateprotocol,whichmeansthatclientandservertrytonegotiatea
protocolthatbothsupport.
IfthevCenterServersystemtowhichyouareconnectingisconfiguredtouse
aspecificprotocol,youcanspecifythatprotocolusingthisoption.
ThisoptionissupportedonlyifyouarerunningvCLIonaWindowssystem
andconnectingtoavCenterServersystem.
--password <passwd>
Usesthespecifiedpassword(usedwith--username)tologintotheserver.
VI_PASSWORD=<passwd>
If--serverspecifiesavCenterServersystem,theusernameandpassword
applytothatserver.IfyoucanlogintothevCenterServersystem,you
neednoadditionalauthenticationtoruncommandsontheESXihoststhat
servermanages.
If--serverspecifiesanESXihost,theusernameandpasswordapplyto
thatserver.
28
Usesthespecifiedporttoconnecttothesystemspecifiedby--server.Default
is443.
Usesthespecifiedprotocoltoconnecttothesystemspecifiedby--server.
DefaultisHTTPS.
Savesasessiontothespecifiedfile.Thesessionexpiresifithasbeenunused
for30minutes.
VMware, Inc.
Description
--server <server>
UsesthespecifiedESXiorvCenterServersystem.Defaultislocalhost.
VI_SERVER=<server>
If--serverpointstoavCenterServersystem,youusethe--vihostoption
tospecifytheESXihostonwhichyouwanttorunthecommand.Acommand
issupportedforvCenterServerifthe--vihostoptionisdefined.
--servicepath <path>
UsesthespecifiedservicepathtoconnecttotheESXihost.Defaultis
/sdk/webService.
VI_SERVICEPATH=<path>
VI_SESSIONFILE=<file>
Usesthespecifiedsessionfiletoloadapreviouslysavedsession.Thesession
mustbeunexpired.
--url <url>
ConnectstothespecifiedvSphereWebServicesSDKURL.
--sessionfile <file>
VI_URL=<url>
--username <u_name>
Usesthespecifiedusername.
VI_USERNAME=<u_name>
If--serverspecifiesavCenterServersystem,theusernameand
passwordapplytothatserver.IfyoucanlogintothevCenterServer
system,youneednoadditionalauthenticationtoruncommandsonthe
ESXihoststhatservermanages.
If--serverspecifiesanESXisystem,theusernameandpasswordapply
tothatsystem.
Ifyoudonotspecifyausernameandpasswordonthecommandline,the
systempromptsyouanddoesnotechoyourinputtothescreen.
WhenyourunavCLIcommandwiththe--serveroptionpointingtoa
vCenterServersystem,use--vihosttospecifytheESXihosttorunthe
commandagainst.
--vihost <host>
-h <host
NOTE:Thisoptionisnotsupportedforeachcommand.Ifsupported,the
optionisincludedwhenyourun<cmd> --help.
Table 33listsoptionsnotusedasconnectionoptionsthatyoucanusewhenyourunavicfg-vCLIcommand.
Table 3-3. vCLI Common Options
Option
Description
--help
Printsabriefusagemessage.Themessagelistsfirsteachcommandspecificoptionandthen
eachofthecommonoptions.
--verbose
Displaysadditionaldebugginginformation.
--version
Displaysversioninformation.
VMware, Inc.
29
ThescriptitselfaddstheNASdatastorebycallingthedifferentconfigurationfiles.
#!bin/sh
for i in {"esxi_server_a","esx_server_b","esxi_server_c"}
do
echo "Adding NAS datastore for $i..."
esxcli --config /host.conf storage nfs add -H <hostname> -s <sharepoint> -v <volumename>
esxcli --config <config.file> storage nfs list
done
30
VMware, Inc.
Thisappendixconsistsoftablesofcommandsummariesthatillustratethehierarchyofnamespacesand
commands(inbold)foreachESXCLInamespace.Thisappendixisnotmeanttobeareferencebutfacilitates
locatingtheonlinehelpforindividualcommands.
Theappendixincludesthefollowingtopics:
esxcliesxcliNamespaceonpage 31
esxclifcoeNamespaceonpage 31
esxclihardwareNamespaceonpage 32
esxcliiscsiNamespaceonpage 32
esxclinetworkNamespaceonpage 33
esxclischedNamespaceonpage 34
esxclisoftwareNamespaceonpage 34
esxclistorageNamespaceonpage 35
esxclisystemNamespaceonpage 36
esxclivmNamespaceonpage 36
VMware, Inc.
31
cpuid[get]
global[get|set]
ipmi
fru[get|list]
sdrlist
sel[get|list]
memory[get]
pci[list]
platform[get]
trustedbood[get]
auth
chap[set|get]
discovery
[rediscover]
sendtarget
[add|list|remove]
auth
chap[get|set]
param[get|set]
statictarget
[add|list|remove]
statusget
target[list]
portal[list]
auth
chap[get|set]
param[get|set]
capabilitiesget
firmware[get|set]
param[get|set]
ibftboot[get|import]
logicalnetworkportallist
networkportal[add|list|remove]
ipconfig[get|set]
physicalnetworkportal[list]
param[get|set]
pluginlist
session[add|list|remove]
connectionlist
software[get|set]
32
VMware, Inc.
network[list]
bte[list]
port[list]
firewall
[get|load|refresh|set|unload]
ruleset[list|set]
allowedip[add|
list|remove]
rule[list]
ip[get|set]
connection[list]
dns
search
[add|list|remove]
server
[add|list|remove]
interface
[add|list|remove|
set]
ipv4[get|set]
ipv6[get|set]
address
[add|list|remove]
tag
[add|get|remove]
ipsec[set]
sa
[add|list|remove]
sp
[add|list|remove]
route
ipv4
[add|list|remove]
ipv6
[add|list|remove]
neighbor[list]
nic[down|get|list|set|up]
stats[get]
vlan
port
stats[get|set]
stats[get]
filter
sroivmic[list]
sriovnicvf[list]
vm
[list]
stats[get]
port[list]
vswitch
dvs
vmware[list]
lacp[getconfig|
getstats|get
status|set]
vxlan[list]
configstats[get
|set]
networklist
VMware, Inc.
33
networkmapping
[list|reset]
networkportlist
networkportstats
[list|reset]
networkstats[list
|reset]
stats[reset]
vmknic[list|reset]
vmknic
multicastgroup
list
vmknicstats[list|
reset]
standard[add|
list|remove|set]
policy[get]
failover[get|set]
security[get|set]
shaping[get|set]
portgroup
[add|list|remove
|set]
policy[set]
failover[get|set]
security[get|set]
shaping[get|set]
uplink
[add|remove]
system[get|get]
profile[get|list]
vib[get|list]
profile[get|install|update|validate]
vib[get|install|list|remove|update]
34
VMware, Inc.
adapter[list|rescan]
stats[get]
device
[list|set|setconfig]
vaai[status]
detached
[list|remove]
partition
[list|showguid]]
smart[get]
stats[get]
vaai
status[get]
world[list]
path[list|set]
stats[get]
claiming
[reclaim|unclaim]
claimrule[add|
convert|list|load|
move|remove|run]
plugin[list]
registration
[add|list|remove]
filesystem[automount|
list|mount|rescan|
unmount]
nfs[add|list|remove]
nmp
device[list|set]
path[list]
psp[list]
fixed
deviceconfig[get|set]
generic
deviceconfig[get|set]
pathconfig[get|set]
satp[list|set]
roundrobin
deviceconfig[get|set]
generic
deviceconfig[get|set]
pathconfig[get|set]
rule
[add|list|remove]
san
fc[list|reset]
events[get|clear]
statsget
vmfs[upgrade]
snapshot[list|mount|
resignature]
fcoe[list|reset]
statsget
iscsilist
statsget
sas[list|reset]
statsget
extentlist
extentlist
VMware, Inc.
35
deviceget
coredump
network[check|
get|set]
partition
[get|list|set]
hostname[get|set]
maintenanceMode[get|set]
module[get|list|load|set]
parameters[list|set]
processlist
stats
loadget
runningget
secpolicy
domain[list|set]
settings
advanced[list|set]
keyboard
layout[get|list|set]
kernel[list|set]
shutdown
[poweroff|reboot]
snmp[get|hash|set|test]
stats
uptimeget
syslog[mark|reload]
config[get|set]
visorfs[get]
ramdisk[add|list|
remove]
logger[list|set]
tardisk[list]
time[get|set]
uuidget
versionget
visorfsget
ramdisk
[add|list|remove]
tardisklist
welcomemsg[get|set]
esxcli vm Namespace
Theesxcli vmnamespaceincludesaprocessnamespacewithalistcommandandakillcommand.
36
VMware, Inc.
Index
Active Directory 21
authentication information 24
Perl 13
precedence 24
prerequisites
Red Hat Enterprise Linux 5.2 16
C
command-line connection parameters 26
configuration files
for authentication 25
usage 25
connection options 24, 27
cp936 encoding 28
creating session files 25
credential store precedence 24
R
Red Hat Enterprise Linux 5.2 16
required parameters 24
running commands
from vMA 21
Linux 16, 24
Windows 19
DCUI 10
deploying vMA 21
direct console 10
E
encoding
cp936 28
Shift_JIS 28
ESXCLI command hierarchies 31
execution options 27
I
installing vCLI
Linux 16, 24
Windows 19
installing vMA 21
L
Linux
installing vCLI 16, 24
running vCLI commands 19, 26
vCLI 16
lockdown mode 27
M
Microsoft Windows Security Support Provider
Interface 27
O
options 27
order of precedence 24
VMware, Inc.
U
uninstalling
Linux 19
on Linux 19
on Windows 20
Using 26
using session files 25
V
vCLI
command-line 26
configuration files 25
environment variables 25
execution options 27
installing on Linux 16, 24
installing on Windows 19
vCLI package
installing on Linux 14
installing on Windows 19
uninstalling 19
unpacking 16, 18
vMA 21
environment variables 25
installing 21
multiple configuration files 26
vSphere Management Assistant 21
37
W
Windows
executing commands 26
installing vCLI 19
running vCLI commands 20
using vCLI 19
38
VMware, Inc.