Professional Documents
Culture Documents
Vsphere Command-Line Interface Installation and Reference Guide
Vsphere Command-Line Interface Installation and Reference Guide
vSphereCommandLineInterface(vSphereCLI)andincludesreferencedocumentationand
examplesforeachcommand.
ThevSphereCommandLineInterfaceInstallationandReferenceGuidecoversESX,ESXi,andvCenterServer.
Chapter 1explainshowtoinstallvSphereCLIandhowtorunvSphereCLIcommandsonWindowsor
Linux.Thechapteralsoincludesareferencetoconnectionoptionsandotheroptionsyoucanusewith
eachofthevSphereCLIcommands.
Chapter 2providesreferencedocumentationformostofthevSphereCLIcommands,organizedby
subjectarea.Foreachcommand,thechapterlistsanddiscusseseachoptionandgivesexamples.
Chapters36providereferencedocumentationformorecomplexvSphereCLIcommands.
Chapter 3discussesvmkfstools.Itincludesinformationaboutthecommandsyntax,filesystem
options,andvirtualdiskoptions.
Chapter 4discussesvicfg-iscsi,whichyoucanuseforiSCSImonitoringandmanagement
operations.
Chapter 5discussesvmware-cmd.Itincludesinformationaboutconnectionoptions,generaloptions,
serveroptions,andvirtualmachineoptions.
Chapter 6discussesesxcli,whichyoucanusetoconfiguretheNativeMultipathingPlugin(NMP),
thePluggableStorageArchitecture(PSA),andNICbindings.
Appendix Adiscussesthevihostupdate35andvicfg-mpath35legacycommands,whichareavailable
forESX/ESXi3.5systems.
Intended Audience
ThisbookisforexperiencedWindowsorLinuxsystemadministratorswhoarefamiliarwithvSphere
administrationtasksanddatacenteroperationsandknowhowtousecommandsinscripts.
Document Feedback
VMwarewelcomesyoursuggestionsforimprovingourdocumentation.Ifyouhavecomments,sendyour
feedbacktodocfeedback@vmware.com.
About This Book
vSphere Command-Line Interface Installation and Reference Guide
8 VMware, Inc.
Related Documentation
ThevSpheredocumentationconsistsofthecombinedVMwarevCenterServerandESX/ESXidocumentation
set.Thedocumentationsetcontainsbackgroundinformationforthecommandsdiscussedinthisdocument.
ThevSphereSDKforPerldocumentationexplainshowyoucanusethevSphereSDKforPerlandrelated
utilityapplicationstomanageyourvSphereenvironmentandincludesinformationaboutthevSphereSDK
forPerlUtilityApplications.
ThevSphereManagementAssistantGuideexplainshowtoinstallandusethevSphereManagementAssistant
(vMA).vMAisavirtualmachinethatincludesthevSphereCLIandotherprepackagedsoftware.See
InstallingvMAandRunningCommandsfromvMAonpage 13.
Technical Support and Education Resources
Thefollowingsectionsdescribethetechnicalsupportresourcesavailabletoyou.Toaccessthecurrentversion
ofthisbookandotherbooks,gotohttp://www.vmware.com/support/pubs.
Online and Telephone Support
Touseonlinesupporttosubmittechnicalsupportrequests,viewyourproductandcontractinformation,and
registeryourproducts,gotohttp://www.vmware.com/support.
Customerswithappropriatesupportcontractsshouldusetelephonesupportforthefastestresponseon
priority1issues.Gotohttp://www.vmware.com/support/phone_support.
Support Offerings
TofindouthowVMwaresupportofferingscanhelpmeetyourbusinessneeds,goto
http://www.vmware.com/support/services.
VMware Professional Services
VMwareEducationServicescoursesofferextensivehandsonlabs,casestudyexamples,andcoursematerials
designedtobeusedasonthejobreferencetools.Coursesareavailableonsite,intheclassroom,andlive
online.Foronsitepilotprograms andimplementationbestpractices,VMwareConsultingServicesprovides
offeringsto helpyouassess,plan,build,andmanageyourvirtualenvironment.Toaccessinformationabout
educationclasses,certificationprograms,andconsultingservices,gotohttp://www.vmware.com/services.
VMware, Inc. 9
1
ThevSphereCLIcommandsetallowsyoutoruncommonsystemadministrationcommandsagainst
ESX/ESXIsystemsfromanadministrationserverofyourchoice.YoucanrunmostvSphereCLIcommands
againstavCenterServersystemandtargetanyESX/ESXisystemthatsystemmanages.vSphereCLI
commandsareespeciallyusefulforESXihostsbecausetheydonotincludeaserviceconsole.
vSphereCLIcommandsrunontopofthevSphereSDKforPerl.ThevSphereCLI,vSphereSDKforPerl,and
someprerequisitesoftwareareincludedintheinstallationpackageonWindowsandonsupportedLinux
distributions.
Thischapterincludesthefollowingtopics:
InstallingandUsingvSphereCLICommandsonpage 9
InstallingvSphereCLIandRunningCommandsonLinuxonpage 10
InstallingvSphereCLIandRunningCommandsonWindowsonpage 12
InstallingvMAandRunningCommandsfromvMAonpage 13
SpecifyingAuthenticationInformationonpage 13
AvailableOptionsforvSphereCLIExecutiononpage 16
UsingvSphereCLICommandsinScriptsonpage 18
ListofAvailableCommandsonpage 19
SupportedPlatformsforCommandsonpage 20
CommandswithanesxcfgPrefixonpage 22
Installing and Using vSphere CLI Commands
YoucaninstallavSphereCLIpackageoneitherLinuxorMicrosoftWindows,ordeploythevSphere
ManagementAssistant(vMA).
vSphereCLIpackagesYoucaninstallavSphereCLIpackageonaphysicalorvirtualmachine,which
couldbecometheremoteadministrationserverforallESX/ESXihosts.SeeInstallingvSphereCLIand
RunningCommandsonLinuxonpage 10andInstallingvSphereCLIandRunningCommandson
Windowsonpage 12.
Afteryouhaveinstalledthepackage,whichincludesthevSphereSDKforPerl,youcanrunvSphereCLI
commandsorrunscriptsfromtheoperatingsystemcommandline.Eachtimeyourunacommand,you
specifytheconnectionoptionsdirectlyorindirectly.SeeSpecifyingAuthenticationInformationon
page 13.
vSphere CLI Installation, Execution,
and Command Overviews 1
vSphere Command-Line Interface Installation and Reference Guide
10 VMware, Inc.
vMAAvirtualmachinethatadministratorscanusetorunscriptstomanageESX/ESXiservers.vMA
includesvSphereCLIandotherprepackagedsoftwareinaLinuxenvironment.
OneimportantfunctionofvMAisnoninteractivelogin.IfyouestablishanESX/ESXihostasatarget
server,youcanexecutevSphereCLIcommandsagainstthatserverwithoutadditionalauthentication.If
youestablishavCenterServersystemasatargetserver,youcanexecutemostvSphereCLIcommands
againstallESX/ESXisystemsitmanageswithoutadditionalauthentication.SeeInstallingvMAand
RunningCommandsfromvMAonpage 13.
YoucanusevSphereCLIcommandsinteractivelyorinscripts,asfollows:
OpenacommandpromptonaLinuxorWindowssystemwhereyouinstalledthevSphereCLI.Enter
commandsinthatcommandprompt.
AccessthevMALinuxconsole.EntervSphereCLIcommandsthere.
PreparescriptswithsetsofvSphereCLIcommands.Thenrunthescriptsfromaremoteadministration
serverthathasthevSphereCLIpackageinstalledorfromthevMALinuxconsole.SeeUsingvSphere
CLICommandsinScriptsonpage 18.
Whenyouruncommands,youmustspecifytheESX/ESXihostagainstwhichyouwanttorunthecommand
andtheusernameandpasswordforauthentication.SeeSpecifyingAuthenticationInformationonpage 13.
Installing vSphere CLI and Running Commands on Linux
TheinstallationscriptforthevSphereCLIissupportedondefaultinstallationsofthefollowingLinux
distributions:
RedHatEnterpriseLinux(RHEL)5.2(64bit)
RedHatEnterpriseLinux(RHEL)5.2(32bit)
SUSEEnterpriseServer10SP132bit
Ubuntu8.0432bit
ThevSphereCLIpackageinstallerinstallsthevSphereCLIscriptsandthevSphereSDKforPerl.Ifyouarenot
usingoneofthesupportedLinuxdistributions,youmustmakesureyoursystemhasallrequiredlibraries
installed.SeethevSphereSDKforPerlInstallationGuideforinformationaboutrequiredlibraries.
IfyouhaveuninstalledapreviousversionofthevSphereCLI(oldproductnameisRemoteCLI),andinstall
vSphereCLIinadifferentdirectory,youmustresetthePATHenvironmentvariable.Youcandosobeforeor
aftertheinstallation,usingthecommandappropriateforyourdistributionorshell(setenv,export,andso
on).IfyoudonotresetthePATH,thesystemmightstillgototheoldlocationtofindvSphereCLIcommands.
CAUTIONSpecifyingthepasswordinplaintextrisksexposingthepasswordtootherusers.Thepassword
mightalsobecomeexposedinbackupfiles.Donotprovideplaintextpasswordsonproductionsystems.
Youhavethefollowingalternatives:
IfyouuseavSphereCLIcommandinteractivelyanddonotspecifyausernameandpassword,youare
promptedforthem.Thescreendoesnotechothepasswordyoutype.
Fornoninteractiveuse,youcancreateasessionfileusingthesave_session.plscriptincludedinthe
apps/sessiondirectoryofthevSphereSDKforPerl.SeeUsingaSessionFileonpage 14.
IfyouarerunningonWindowssystems,youcanusethe--passthroughauthcommand.Iftheuserwho
runsthecommandisknown,nopasswordisrequired.
IfyouarerunningvMA,youcansetuptargetserversandexecutemostvSphereCLIcommandsagainst
targetserverswithoutadditionalauthentication.
VMware, Inc. 11
Chapter 1 vSphere CLI Installation, Execution, and Command Overviews
Unpacking and Installing the vSphere CLI Package
YoumustdownloadthevSphereCLIpackagefromtheVMwareWebsitebeforeyoucaninstallvSphereCLI.
To download and unpack the vSphere CLI package
1 DownloadtheinstallerpackagefromtheVMwareWebsite.
YoucanfindtheinstallerintheDriversandToolstabofthevSphere4.0downloadpage.
2 Openashellpromptandnavigatetothedirectorytowhichyoudownloadedthepackage.
3 Unzipandunpackthedownloadedpackage.
To install the vSphere CLI package
1 Starttheinstaller(vmware-install.pl).
2 TypeyesattheprompttoacceptthelicenseagreementtermsandpressEntertocontinue.
3 Whenprompted,specifyaninstallationdirectory,orpressEntertoacceptthedefault(/usr/bin).
4 (Optional)IfpromptedtoremoveolderversionsofvSphereSDKforPerlorvSphereCLI,youcaneither
accepttheofferorinstallthepackageonadifferentsystem.
Theinstallerindicatescompletionoftheprocessasfollows:
Asuccessmessageappearsandthepromptreturnstotheshellprompt.
Theinstallerlistsdifferentversionnumbersforrequiredmodules(ifany).
ThevSphereCLIscriptsareintheinstallationdirectory.Thedefaultis/usr/bin.
YoucanrunavSphereCLIcommandtoverifythatinstallationwassuccessful.SeeRunningvSphereCLI
Commandsonpage 11.
vSphereSDKforPerlutilityapplicationsandsamplescriptsthatperformcommonoperationsonESX/ESXi
hostsandonvirtualmachinesareincludedwiththeinstallationatthefollowinglocations:
Utilityapplications/usr/lib/vmware-vcli/apps
Samplescripts/usr/share/doc/vmware-vcli/samples
SeethevSphereSDKforPerldocumentationforareferencetoallutilityapplications.
Running vSphere CLI Commands
AfteryouhaveinstalledthevSphereCLI,youcanruncommandsdirectlyontheLinuxcommandpromptor
includetheminscripts(seeUsingvSphereCLICommandsinScriptsonpage 18).
To run a vSphere CLI command on Linux
1 Openacommandprompt.
2 ChangetothedirectorywhereyouinstalledthevSphereCLI.Thedefaultis/usr/bin.
3 Runthecommand,includingtheconnectionoptions.
<command> <conn_options> <params>
Specifyconnectionoptionsinaconfigurationfileorpassthemonthecommandline.Theextension.pl
isnotrequiredonLinux.
Example
vicfg-nas --server my_esxserver --username u42 --password mypwd --list
SeeTable 12,vSphereCLIConnectionOptions,onpage 17foracompletelistofconnectionoptions.
IMPORTANTTheinstallerreplacesboththevSphereSDKforPerlandthevSphereCLI.Installthepackage
onadifferentsystemtokeepanolderversion.
vSphere Command-Line Interface Installation and Reference Guide
12 VMware, Inc.
Uninstalling the vSphere CLI Package
YoucanuninstallthevSphereCLIpackageusingascriptincludedintheinstallation.
To uninstall the vSphere CLI on a Linux system
1 ConnecttothedirectorywhereyouinstalledthevSphereCLI(defaultis/usr/bin).
2 Runthevmware-uninstall-vSphere-CLI.pl script.
ThecommanduninstallsthevSphereCLIandthevSphereSDKforPerl.
Installing vSphere CLI and Running Commands on Windows
ThevSphereCLIinstallationpackageforWindowsincludestheActivePerlruntimefromActiveStateSoftware
andrequiredPerlmodulesandlibraries.ThevSphereCLIissupportedonthefollowingWindowsplatforms:
WindowsXPSP232bit
WindowsXPSP264bit
WindowsVistaEnterpriseSP132bit
WindowsVistaEnterpriseSP164bit
To install the vSphere CLI Package on Windows
1 DownloadthevSphereCLIWindowsinstallerpackage.
YoucanfindtheinstallerintheDriversandToolstabofthevSphere4.0downloadpage.
2 Starttheinstaller.
3 (Optional)IfpromptedtoremoveolderversionsofvSphereSDKforPerlorvSphereCLI,youcaneither
accepttheofferorinstallthepackageonadifferentsystem.
4 ClickNextintheWelcomepagetocontinue.
5 IfyoudowanttoinstallthevSphereCLIinanondefaultdirectory,clickChangeandselectthedirectory.
ThedefaultlocationisC:\Program Files\VMware\VMware vSphere CLI.
6 ClickNexttocontinue.
7 ClickInstalltoproceedwiththeinstallation.
Theinstallationmighttakeseveralminutestocomplete.
AfteryouinstallthevSphereCLI,youcanruncommandsfromtheWindowscommandpromptorinclude
theminscripts(seeUsingvSphereCLICommandsinScriptsonpage 18).
To run a vSphere CLI command on Windows
1 Openacommandprompt.
2 NavigatetothedirectoryinwhichthevSphereCLIisinstalled.
cd C:\Progrsam Files\VMware\VMware vSphere CLI\bin
3 Runthecommand,passingintheconnectionoptionsandanyotheroptions.
<command>.pl <conn_options> <params>
Theextension.plisrequiredformostcommands,butnotforesxcli.
Example
vicfg-nas.pl --server my_vcserver --username u42 --password mypwd --vihost my_esxhost --list
SeeTable 12,vSphereCLIConnectionOptions,onpage 17foracompletelistofconnectionoptions.
IMPORTANTTheinstallerreplacesboththevSphereSDKforPerlandthevSphereCLI.Installthis
packageonadifferentsystemtokeepanolderversion.
VMware, Inc. 13
Chapter 1 vSphere CLI Installation, Execution, and Command Overviews
Uninstalling the vSphere CLI Package
YoucanuninstallthevSphereCLIpackageasyouwouldanyotherpackage.
To uninstall the vSphere CLI on a Windows system
1 SelectStart>Settings>ControlPanel>AddorRemovePrograms.
2 Inthepanelthatappears,selectvSphereCLI,andclickRemove.
3 ClickYeswhenprompted.
ThesystemuninstallsboththevSphereSDKforPerlandthevSphereCLI.
Installing vMA and Running Commands from vMA
Asanalternativetoapackageinstallation,youcandeployvMAonanESX/ESXihostandrunvSphereCLI
commandsfromthere.vMAisavirtualmachinethatadministratorscanusetorunscriptstomanage
ESX/ESXisystems.vMAincludesvSphereCLIandotherprepackagedsoftwareinaLinuxenvironment.
SettingupvMAconsistsofafewtasks.ThevSphereManagementAssistantAdministratorsandDevelopersGuide
discusseseachtaskindetail.
1 DeployvMAtoanESX/ESXisystemofyourchoice.
YoucanuseavSphereClientconnecteddirectlytotheESX/ESXisystem,oravSphereClientconnected
toavCenterServersystem.YoucandeployvMAfromaURLordownloadafile,unzipit,andpointto
theOVFfileduringthedeployprocess.
2 ConfigurevMA.
WhenyoubootvMA,itpromptsyouforthefollowingrequiredconfigurationinformation:
Networkinformation(thedefaultisoftenacceptable)
AhostnameforvMA.
Apasswordfortheviadminuser.TherootuserisdisabledonvMA.
3 (Optional)AddavCenterServersystemormoreESX/ESXisystemstovMAasvifastpasstargetsandcall
vifpinittoinitializevifastpass.
Afteryouhavespecifiedahostasavifastpasstarget,specifyingconnectionoptionsisnolongerrequired
becauseauthenticationhasalreadyoccurred.YoucanrunvSphereCLIcommandsagainstanyESX/ESXi
systemwithoutspecifyingconnectionoptionsforthatsystemexplicitly.IfyousetupavCenterServersystem
asatargetserver,youcanspecifyanyoftheESX/ESXihoststhatvCenterServersystemmanagesusingthe
--vihostoption.
Specifying Authentication Information
WhenyourunavSphereCLIcommand,youmustspecifyataminimumthenameoftheexecutionserverand
thenameandpasswordofauserwithloginprivileges.vSphereCLIallowsyoutorunagainstmultiple
executionserversfromthesameadministrationserver,butyoumusthavethecorrectprivilegestoperform
theactionsoneachexecutionserver.
vSphere Command-Line Interface Installation and Reference Guide
14 VMware, Inc.
Order of Precedence
WhenyourunavSphereCLIcommand,authenticationhappensintheorderofprecedencepresentedin
Table 11.
Thisorderofprecedencealwaysapplies.Thatmeans,forexample,thatyoucannotoverrideanenvironment
variablesettinginaconfigurationfile.
Using a Session File
Youcancreateasessionfileusingthesave_session.plscript.Thescriptisinthe/apps/sessiondirectory
ofthevSphereSDKforPerl,whichisincludedinthevSphereCLIpackage.Youcanusethesessionfile,which
doesnotrevealpasswordinformation,whenyourunvSphereCLIcommands.Ifthesessionfileisnotused
for30 minutes,itexpires.
Ifyouuseasessionfile,anyotherconnectionoptionsareignored.
To create and use a session file
1 Connecttothedirectorywherethescriptislocated.
Forexample:
2 Callsave_session.pl.
Youmustspecifytheservertoconnecttoandthenameofasessionfileinwhichthescriptsavesan
authenticationcookie.
save_session.pl --savesessionfile <location> --server <server>
Forexample:
Ifyouspecifyaserver,butnousernameorpassword,thescriptpromptsyou.
Table 1-1. vSphere CLI Authentication Precedence
Authentication Description See
Commandline Password(--password),sessionfile
(--sessionfile),orconfigurationfile
(--config)specifiedonthecommandline.
UsingaSessionFileonpage 14
Configurationfile Passwordspecifiedina.visdkrcconfiguration
file.
UsingaConfigurationFileonpage 15
Environment
variable
Passwordspecifiedinanenvironmentvariable. UsingEnvironmentVariablesonpage 15
Credentialstore Passwordretrievedfromthecredentialstore. vSphereWebServicesSDKProgrammingGuide
andvSphereSDKforPerlProgrammingGuide.
Currentaccount
(ActiveDirectory)
Currentaccountinformationusedtoestablish
anSSPIconnection.AvailableonlyonWindows.
UsingMicrosoftWindowsSecuritySupport
ProviderInterface(SSPI)onpage 16
Prompttheuserfor
apassword.
Passwordisnotechoedtoscreen.
Windows: cd C:\Program Files\VMware\VMware vSphere CLI\Perl\apps\session
Linux: cd /usr/share/doc/vmware-vcli/samples/session
Windows: save_session.pl --savesessionfile C:\Temp\my_session --server my_server
Linux: save_session.pl --savesessionfile /tmp/vimsession --server
<servername_or_address> --username <username> --password <password>
VMware, Inc. 15
Chapter 1 vSphere CLI Installation, Execution, and Command Overviews
3 Passinthesessionfileusingthe--sessionfileoptionwhenyourunvSphereCLIcommands,
as follows:
<command> --sessionfile <sessionfile_location> <command_options>
Forexample:
Using Environment Variables
YoucansetenvironmentvariablesinaLinuxprofile,intheEnvironmentpropertiesdialogboxoftheSystem
controlpanelonWindows,or,forthecurrentsession,atthecommandline.Forexample:
set VI_SERVER=<your_server_name_or_address>
SeeUsingvSphereCLICommandsinScriptsonpage 18foranexample.
Using a Configuration File
Youcanuseatextfilethatcontainsvariablenamesandsettingsasaconfigurationfile.Variablescorresponding
totheoptionsareshowninTable 12,vSphereCLIConnectionOptions,onpage 17.
PassintheconfigurationfilewhenyourunvSphereCLIcommands,asfollows:
<command> --config <my_saved_config> <option>
Forexample:
vicfg-mpath --config <my_saved_config> --list
IfyouhavemultiplevCenterServerorESX/ESXisystemsandyouadministereachsystemindividually,you
cancreatemultipleconfigurationfileswithdifferentnames.Torunacommandorasetofcommandsona
server,youpassinthe--configoptionwiththeappropriatefilenameatthecommandline.
Thefollowingexampleillustratesthecontentsofaconfigurationfile:
VI_SERVER = NN.NNN.NNN.NN
VI_USERNAME = root
VI_PASSWORD = my_password
VI_PROTOCOL = https
VI_PORTNUMBER = 443
Ifyouhavesetupyoursystemtorunthisfile,youcanrunscriptsonthespecifiedserverafterwards.
Using Command-Line Options
Youcanpassincommandlineoptionsusingoptionnameandoptionvaluepairs.
--<optionname optionvalue>
Someoptions,suchas--help,havenovalue.
Thefollowingsyntaxresults:
<command> --server <vc_server> --username <privileged_user> --password <pw> --vihost <esx_host>
--<option_name option_value>
Windows: vicfg-mpath.pl --sessionfile C:\Temp\my_session --list
Linux: vicfg-mpath --sessionfile /tmp/vimsession --list
IMPORTANTDonotuseescapecharactersinenvironmentvariables.
CAUTIONLimitreadaccesstoaconfigurationfilethatcontainsusercredentials.
IMPORTANTThepasswordisinplaintext,soyoumustlimitaccesstothisfile.
vSphere Command-Line Interface Installation and Reference Guide
16 VMware, Inc.
Examples
Thefollowingexamplesconnecttotheserverasusersnow-whitewithpassworddwarf$.Theexamplecalls
vicfg-mpathwithnooptions.Thesystemdisplayshelpinformationforthecommandinthatcase.
Thefirstexample(Linux)usesthe\escapecharacter,theothertwousesinglequotes(Linux)anddouble
quotes(Windows).
Linux
vicfg-mpath --server <server> --username snow\-white --password dwarf\$
vicfg-mpath --server <server> --username snow-white --password dwarf$
Windows
vicfg-mpath.pl --server <server> --username snow-white --password dwarf$
Using Microsoft Windows Security Support Provider Interface (SSPI)
The--passthroughoutoption,whichisavailableifyourunvSphereCLIcommandsfromaMicrosoft
Windowssystem,allowsyoutousetheMicrosoftWindowsSecurityProviderInterface(SSPI).Seethe
MicrosoftWebsiteforadetaileddiscussionofSSPI.
Youcanuse--passthroughauthtoestablishaconnectionwithavCenterServersystem(vCenterServer
systemorVirtualCenterServer3.5Update2orlater).Aftertheconnectionhasbeenestablished,authentication
forthevCenterServersystemoranyESX/ESXisystemitmanagesisnolongerrequired.Using
--passthroughauthpassesthecredentialsoftheuserwhorunsthecommandtothetargetvCenterServer
system.IftheuserwhorunsthecommandisknownbyboththemachinefromwhichyouaccessthevCenter
ServersystemandthemachinerunningthevCenterServersoftware,noadditionalauthenticationisrequired.
IfvSphereCLIcommandsandthevCenterServersoftwarerunonthesamemachine,alocalaccountforthe
userwhorunsthecommandworks.Iftheyrunondifferentmachines,theuserwhorunsthecommandmust
haveanaccountinadomaintrustedbybothmachines.
SSPIsupportsanumberofprotocols.Bydefault,itselectstheNegotiateprotocol,whereclientandserver
attempttofindaprotocolthatbothsupport.Youcanuse--passthroughauthpackagetoexplicitlyspecifya
protocolsupportedbySSPI.Kerberos,theWindowsstandardfordomainlevelauthentication,isused
frequently.IfthevCenterServersystemisconfiguredtoacceptonlyaspecificprotocol,specifyingtheprotocol
with --passthroughauthpackagemightberequiredforsuccessfulauthentication.Ifyouuse
--passthroughauth,youdonothavetospecifyauthenticationinformationinanyotherway.
Example
vicfg-mpath --server <vc_server> --passthroughauth --passthroughauthpackage Kerberos
--vihost my_esx --list
ConnectstoaserverthathasbeensetuptouseSSPI.Whenyourunthecommand,thesystemcalls
vicfg-mpathwiththe--listoption.Thesystemdoesnotpromptforausernameandpassword.
Available Options for vSphere CLI Execution
Table 12listsoptionsthatareavailableforallvSphereCLIcommandsinalphabeticalorder.Thetableincludes
optionsforuseonthecommandlineandvariablesforuseinconfigurationfiles.
SpecifyingAuthenticationInformationonpage 13explainshowtousetheoptions.
IMPORTANTEnclosepasswordsandothertextwithspecialcharactersinquotationmarks.
OnLinux,usesinglequotes( ),onWindows,usedoublequotes( ).OnLinux,youcanalsouseabackslash
(\)asanescapecharacter.
IMPORTANTForconnections,vSphereCLIsupportsonlytheIPv4protocol,nottheIPv6protocol.Youcan,
however,performIPv6configurationonthetargethostwithseveralofthenetworkingcommands.
VMware, Inc. 17
Chapter 1 vSphere CLI Installation, Execution, and Command Overviews
Table 1-2. vSphere CLI Connection Options
Option and Environment
Variable
Description
--config <config_file>
VI_CONFIG=<config_file>
Usestheconfigurationfileatthespecifiedlocation.
Specifyapaththatisreadablefromthecurrentdirectory.
--credstore <credstore> Nameofacredentialstorefile.Defaultsto
<HOME>/.vmware/credstore/vicredentials.xmlonLinuxand
<APPDATA>/VMware/credstore/vicredentials.xmlonWindows.Commands
forsettingupthecredentialstoreareincludedinthevSphereSDKforPerl,whichis
installedwiththevSphereCLI.ThevSphereSDKforPerlProgrammingGuideexplains
howtousethecredentialstore.
--encoding <encoding>
VI_ENCODING=<encoding>
Specifiestheencodingtobeused.Oneofcp936(SimplifiedChinese)ISO-8859-1
(German),orShift_JIS(Japanese).
Youcanuse--encodingtospecifytheencodingthevSphereCLIshouldmapto
whenitisrunonaforeignlanguagesystem.
--passthroughauth
VI_PASSTHROUGHAUTH
Ifyouspecifythisoption,thesystemusestheMicrosoftWindowsSecuritySupport
ProviderInterface(SSPI)forauthentication.Youarenotpromptedforausername
andpassword.SeetheMicrosoftWebsiteforadetaileddiscussionofSSPI.
ThisoptionissupportedonlyifyouarerunningthevSphereCLIonaWindows
systemandareconnectingtoavCenterServersystem.
--passthroughauthpackage
<package>
VI_PASSTHROUGHAUTHPACKAGE=
<package>
Usethisoptionwith--passthroughauthtospecifyadomainlevelauthentication
protocoltobeusedbyWindows.Bydefault,SSPIusestheNegotiateprotocol,
whichmeansthatclientandserverattempttonegotiateaprotocolthatboth
support.
IfthevCenterServersystemtowhichyouareconnectingisconfiguredtousea
specificprotocol,youcanspecifythatprotocolusingthisoption.
ThisoptionissupportedonlyifyouarerunningthevSphereCLIonaWindows
systemandconnectingtoavCenterServersystem.
--password <passwd>
VI_PASSWORD=<passwd>
Usesthespecifiedpassword(usedwith--username)tologintotheserver.
If--serverspecifiesavCenterServersystem,theusernameandpassword
applytothatserver.Youneednoauthenticationtoruncommandsonthe
ESX/ESXihoststhatservermanages.
If--serverspecifiesanESX/ESXihost,theusernameandpasswordapplyto
thatserver.
Usetheemptystring(' 'onLinuxand onWindows)toindicatenopassword.
Ifyoudonotspecifyausernameandpasswordonthecommandline,thesystem
promptsyouanddoesnotechoyourinputtothescreen.
--portnumber <number>
VI_PORTNUMBER=<number>
UsesthespecifiedporttoconnecttotheESX/ESXihost.Defaultis443.
--protocol <HTTP|HTTPS>
VI_PROTOCOL=<HTTP|HTTPS>
UsesthespecifiedprotocoltoconnecttotheESX/ESXihost.DefaultisHTTPS.
--savesessionfile <file>
VI_SAVESESSIONFILE=<file>
Savesasessiontothespecifiedfile.Thesessionexpiresifithasbeenunusedfor
thirtyminutes.
--server <server>
VI_SERVER=<server>
UsesthespecifiedESX/ESXiorvCenterServersystem.Defaultislocalhost.
If--serverpointstoavCenterServersystem,youusethe--vihostoptionto
specifytheESX/ESXihostonwhichyouwanttorunthecommand.Acommandis
supportedforvCenterServerifthe--vihostoptionisdefined.
--servicepath <path>
VI_SERVICEPATH=<path>
UsesthespecifiedservicepathtoconnecttotheESX/ESXihost.Defaultis
/sdk/webService.
--sessionfile <file>
VI_SESSIONFILE=<file>
Usesthespecifiedsessionfiletoloadapreviouslysavedsession.Thesessionmust
beunexpired.
--url <url>
VI_URL=<url>
ConnectstothespecifiedvSphereWebServicesSDKURL.
vSphere Command-Line Interface Installation and Reference Guide
18 VMware, Inc.
Table 13listsoptionsnotusedasconnectionoptionsthatyoucanusewhenyourunavSphereCLIcommand.
Using vSphere CLI Commands in Scripts
Mostadministratorsrunscriptstoperformthesametaskrepeatedlyortoperformataskonmultiplehosts.
YoucanrunvSphereCLIcommandsfromoneadministrationserveragainstmultipletargetservers.
Forexample,whenanewdatastorebecomesavailableinyourenvironment,youmustmakethatdatastore
availabletoeachESX/ESXihost.ThefollowingsamplescriptillustrateshowtomakeaNASdatastoreavailable
tothreehosts(esxi_server_a,esx_server_b,andesxi_server_c).
Thesampleassumesthataconfigurationfile/home/admin/.visdkrc.<hostname>existsforeachhost.For
example,theconfigurationfileforesxi_server_ahasthefollowingcontents:
VI_SERVER = esxi_server_a
VI_USERNAME = root
VI_PASSWORD = xysfdjkat
ThescriptitselfaddstheNASdatastorebycallingthedifferentconfigurationfiles.
#!bin/sh
for i in {"esxi_server_a","esx_server_b","esxi_server_c"}
do
echo "Adding NAS datastore for $i..."
vicfg-nas --config /home/admin/.visdkrc.$i -a -o mainnas.x.com -s /shared nas_ds
vicfg-nas --config /home/admin/.visdkrc.$i -l
done
--username <u_name>
VI_USERNAME=<u_name>
Usesthespecifiedusername.
If--serverspecifiesavCenterServersystem,theusernameandpassword
applytothatserver.Youneednoauthenticationtoruncommandsonthe
ESX/ESXisystemsthatservermanages.
If--serverspecifiesanESX/ESXisystem,theusernameandpasswordapply
tothatsystem.
Ifyoudonotspecifyausernameandpasswordonthecommandline,thesystem
promptsyouanddoesnotechoyourinputtothescreen.
--vihost <host>
-h <host
WhenyourunavSphereCLIcommandwiththe--serveroptionpointingtoa
vCenterServersystem,use--vihosttospecifytheESX/ESXihosttorunthe
commandagainst.
NOTE:Thisoptionisnotsupportedforeachcommand.Ifsupported,theoptionis
includedintheindividualcommandoptionlist.
Table 1-3. vSphere CLI Common Options
Option Description
--help Printsabriefusagemessage.Themessagelistsfirsteachcommandspecificoptionandthen
eachofthecommonoptions.
--verbose Displaysadditionaldebugginginformation.
--version Displaysversioninformation.
--vihost WhenyourunavSphereCLIcommandwiththe--serveroptionpointingtoavCenterServer
system,use--vihosttospecifytheESX/ESXihosttorunthecommandagainst.Usethehost
nameorIPaddress,dependingonwhatyouspecifiedwhenyouaddedthehosttothevCenter
Serversystem.
Thisoptionisnotsupportedforallcommandsandlistedintheoptiontableofeachcommand
itappliesto.
Table 1-2. vSphere CLI Connection Options (Continued)
Option and Environment
Variable
Description
VMware, Inc. 19
Chapter 1 vSphere CLI Installation, Execution, and Command Overviews
List of Available Commands
Table 14listsallvSphereCLIcommandsinalphabeticalorderandpointstothevSphereCLIdiscussioninthis
documentandrelateddocumentation.
Table 1-4. vSphere CLI Commands Supported by ESX/ESXi
Command Description See
esxcli Managepluggablestoragearchitecture(PSA)
andnativemultipathing(NMP).
StoragePathandStoragePluginManagement
withesxclionpage 83.
resxtop MonitorsinrealtimehowESXhostsuse
resources.Runsininteractiveorbatchmode.
ThiscommandissupportedonlyonLinux.
SeeUsingresxtopforPerformance
Monitoringonpage 39foranintroduction.
SeetheResourceManagementGuidefora
detailedreference.
svmotion Movesavirtualmachinesconfigurationfileand
optionallyitsdiskswhilethevirtualmachineis
running.
MustrunagainstavCenterServersystem.
VirtualMachineMigrationwithsvmotion
onpage 44foranintroduction.SeetheBasic
SystemAdministrationguideforanindepth
discussionthatincludesexamples.
vicfg-advcfg Performsadvancedconfigurationincluding
enablinganddisablingCIMproviders.Usethis
commandasinstructedbyVMware.
AdvancedManagementwithvicfgadvcfg
onpage 46.
vicfg-cfgbackup BacksuptheconfigurationdataofanESXi
systemandrestorespreviouslysaved
configurationdata.
ConfigurationInformationBackupwith
vicfgcfgbackuponpage 39.Seethe
ESXi EmbeddedandvCenterServerSetupGuide
foranindepthdiscussionthatincludes
stepbystepinstructions.
vicfg-dns SpecifiesanESX/ESXihostsDNS(Domain
NameServer)configuration.
DNSConfigurationSpecificationwith
vicfgdnsonpage 31.
vicfg-dumppart Managesdiagnosticpartitions. DiagnosticPartitionManagementwith
vicfgdumppartonpage 25.
vicfg-iscsi ManagesiSCSIstorage. iSCSIStorageManagementwithvicfgiscsi
onpage 63.
vicfg-module EnablesVMkerneloptions.Usethiscommand
withtheoptionslistedinthisdocument,oras
instructedbyVMware.
VMkernelModuleManipulationwith
vicfgmoduleonpage 47.
vicfg-mpath
vicfg-mpath35
Configuresstoragearrays.
Usevicfg-mpath35forESX/ESXi3.5hosts.
BasicStorageArrayManagementwith
vicfgmpathonpage 27.
StorageArrayConfigurationfor
VMware Infrastructure 3.5Systemswith
vicfgmpath35onpage 99
vicfg-nas ManagesNASfilesystems. NASFileSystemManagementwith
vicfgnasonpage 28.
vicfg-nics ManagestheESX/ESXihostsphysicalNICs. PhysicalNICManagementwithvicfgnics
onpage 32.
vicfg-ntp SpecifiestheNTP(NetworkTimeProtocol)
server.
NTPServerSpecificationwithvicfgntpon
page 33.
vicfg-rescan Rescansthestorageconfiguration. RescanOperationswithvicfgrescanon
page 30.
vicfg-route ManipulatestheESX/ESXihostsrouteentry. RouteEntryManipulationwithvicfgroute
onpage 34.
vicfg-scsidevs FindsavailableLUNs. AvailableLUNDiscoverywith
vicfgscsidevsonpage 29.
vicfg-snmp ManagestheSimpleNetworkManagement
Protocol(SNMP)agent.
SNMPManagementwithvicfgsnmpon
page 40.UsingSNMPinavSphere
environmentisdiscussedindetailintheBasic
SystemAdministrationmanual.
vSphere Command-Line Interface Installation and Reference Guide
20 VMware, Inc.
Supported Platforms for Commands
vSphereCLI4.0supportsmorefunctionalitythanvSphereCLI3.5.Differentcommandssupportadifferent
rangeoftargetservers.
MostcommandscanrunagainstanESX/ESXisystemandhavevCenterServersupport.vCenterServer
supportmeansthatyoucanconnecttoavCenterServersystem,anduse--vihosttospecifytheESX/ESXi
hosttorunthecommandagainst.Theonlyexceptionissvmotion,whichyoucanrunagainstvCenterServer
systemsbutnotagainstESX/ESXisystems.
ThefollowingcommandsmusthaveanESX/ESXisystem,notavCenterServersystemtarget:
vicfg-snmp
vifs
vicfg-user
vicfg-cfgbackup
vihostupdate
vmkfstools
esxcli
Youcannotrunthevihostupdateandvicfg-mpathcommandsthatareinthevSphereCLI4.0installation
againstESX/ESXi3.5orvCenter2.5systems.Instead,runvihostupdate35andvicfg-mpath35,includedin
thevSphereCLI4.0installation,againstthosesystems.vihostupdate35issupportedforESXibutnotESX.
vicfg-syslog Specifiesthesyslogserverandtheportto
connecttothatserverforESXihosts.
SyslogServerSpecificationwithvicfgsyslog
onpage 41.TheBasicSystemAdministration
documentdiscussessystemlogsinmoredetail
andexplainshowtosetthemupusingthe
vSphereClient.
vicfg-user Creates,modifies,deletes,andlistslocaldirect
accessusersandgroupsofusers.
UserandGroupManagementwith
vicfguseronpage 48.
vicfg-vmknic Adds,deletes,andmodifiesvirtualnetwork
adapters(VMkernelNICs).
VMkernelNICsManagementwith
vicfgvmkniconpage 35.
vicfg-volume SupportsresignaturingaVMFSsnapshot
volumeandmountingandunmountingthe
snapshotvolume.
VolumeManagementwithvicfgvolumeon
page 49.
vicfg-vswitch Addsorremovesvirtualswitchesormodifies
virtualswitchsettings.
VirtualSwitchManagementwith
vicfgvswitchonpage 36.
vifs Performsfilesystemoperationssuchas
retrievinganduploadingfilesontheremote
server.
FileSystemManipulationwithvifson
page 50.
vihostupdate
vihostupdate35
ManagesupdatesofESX/ESXihosts.Use
vihostupdate35forESXi3.5hosts.
SeealsotheESXiUpgradeGuide.
UpdateManagementwithvihostupdateon
page 42.
PerformingMaintenanceonVMware
Infrastructure 3.5Systemswith
vihostupdate35onpage 101
vmkfstools Createsandmanipulatesvirtualdisks,file
systems,logicalvolumes,andphysicalstorage
devicesonanESX/ESXihost.
FileSystemManagementwithvmkfstools
onpage 53.
vmware-cmd Performsvirtualmachineoperationsremotely.
Thisincludes,forexample,creatingasnapshot,
poweringthevirtualmachineonoroff,and
gettinginformationaboutthevirtualmachine.
VirtualMachineManagementwith
vmwarecmdonpage 79.
Table 1-4. vSphere CLI Commands Supported by ESX/ESXi (Continued)
Command Description See
VMware, Inc. 21
Chapter 1 vSphere CLI Installation, Execution, and Command Overviews
Table 15listsplatformsupportforthedifferentvSphereCLI4.0commands.Thesecommandshavenotbeen
testedagainstVirtualCenter2.5Update2systems.Youcan,however,connecttoavCenterServer4.0system
andtargetESX/ESXi3.5Update2hosts.
IMPORTANTIfyourunvSphereCLI4.0commandsagainstESX/ESXi3.5systems,youcanuseonlytheoptions
supportedbythosesystems.
SeetheVMwareInfrastructureRemoteCommandLineInterfaceInstallationandReferenceGuideforESX/ESXi
Update2foralistofsupportedoptions.Toaccessthatdocument,selectResources,thenDocumentationfrom
theVMwarewebsite.FindthevSpheredocumentationsetandopenthearchive.AsmallnumberofvSphere
CLI4.0optionsaresupportedagainstESX/ESXi3.5Updatehostseventhoughtheywerenotsupportedin
RCLIversion3.5.
RunavSphereCLI4.0commandwith--helpforinformationonoptionsupportwithESX/ESXi3.5Update 2,
orseeVMwareKBarticle1008940formoredetail.
Table 1-5. Platform Support for vSphere CLI 4.0 Commands
Command ESXi 4.0 ESX 4.0 VC 4.0 ESXi 3.5 U2+ ESX 3.5 U2+
esxcli Yes Yes No No No
resxtop Yes Yes Yes Yes Yes
svmotion No No Yes No No
vicfg-advcfg Yes Yes Yes Yes Yes
vicfg-cfgbackup Yes No No Yes No
vicfg-dns Yes Yes Yes Yes Yes
vicfg-dumppart Yes Yes Yes Yes Yes
vicfg-iscsi Yes Yes Yes No No
vicfg-module Yes Yes Yes Yes Yes
vicfg-mpath Yes Yes Yes Usevicfg-mpath35instead.
vicfg-nas Yes Yes Yes Yes Yes
vicfg-nics Yes Yes Yes Yes Yes
vicfg-ntp Yes Yes Yes Yes Yes
vicfg-rescan Yes Yes Yes Yes Yes
vicfg-route Yes Yes Yes Yes Yes
vicfg-scsidevs Yes Yes Yes No No
vicfg-snmp Yes Yes No Yes Yes
vicfg-syslog Yes No Yes Yes No
vicfg-user Yes Yes No Yes Yes
vicfg-vmhbadevs NotincludedinvSphereCLI4.0.Usevicfg-scsidevsinstead.
vicfg-vmknic Yes Yes Yes Yes Yes
vicfg-volume Yes Yes Yes No No
vicfg-vswitch Yes Yes Yes Yes Yes
vifs Yes Yes No Yes Yes
vihostupdate Yes Yes No Use
vihostupdate35
instead
No
vmkfstools Yes Yes No Yes Yes
vmware-cmd Yes Yes Yes Yes Yes
vSphere Command-Line Interface Installation and Reference Guide
22 VMware, Inc.
Table 16listsplatformsupportforthedifferentvSphereCLI3.5commands.Thesecommandsarenot
supportedagainstvSphere4.0systems.
Commands with an esxcfg Prefix
FormanyofthevSphereCLIcommandsyoumighthaveusedscriptswithcorrespondingserviceconsole
commandsstartingwithanesxcfgprefixtomanageESX3.xhosts.TofacilitateeasymigrationfromESX3.x
toESX/ESXi,thecommandswiththeesxcfgprefixareavailableasvSphereCLIcommands.
vicfg-mpath35 No No No Yes Yes
vihostupdate35 No No No Yes No
Table 1-6. Platform Support for vSphere CLI 4.0 Commands
Command ESXi 3.5 U2+ ESX 3.5 U2+ VC 2.5 U2+
esxcli No No No
resxtop Yes Yes No
svmotion N.A. N.A. Yes
vicfg-advcfg Yes Yes Yes
vicfg-cfgbackup Yes No No
vicfg-dns Yes Yes Yes
vicfg-dumppart Yes Yes Yes
vicfg-iscsi No No No
vicfg-module Yes Yes Yes
vicfg-mpath Yes Yes Yes
vicfg-nas Yes Yes Yes
vicfg-nics Yes Yes Yes
vicfg-ntp Yes Yes Yes
vicfg-rescan Yes Yes Yes
vicfg-route Yes Yes Yes
vicfg-scsidevs No No No
vicfg-snmp Yes Yes No
vicfg-syslog Yes No Yes
vicfg-user Yes Yes No
vicfg-vmhbadevs Yes Yes Yes
vicfg-vmknic Yes Yes Yes
vicfg-volume No No No
vicfg-vswitch Yes Yes Yes
vifs Yes Yes No
vihostupdate Yes No No
vmkfstools Yes Yes No
vmware-cmd Yes Yes Yes
Table 1-5. Platform Support for vSphere CLI 4.0 Commands (Continued)
Command ESXi 4.0 ESX 4.0 VC 4.0 ESXi 3.5 U2+ ESX 3.5 U2+
IMPORTANTVMwarerecommendsthatyouusethevSphereCLIcommandswiththevicfgprefix.
Commandswiththeesxcfgprefixareavailablemainlyforcompatibilityreasonsandmightbecomeobsolete.
VMware, Inc. 23
Chapter 1 vSphere CLI Installation, Execution, and Command Overviews
Table 17listsallvSphereCLIcommandsforwhichacommandwithanesxcfgprefixisavailable.
Table 1-7. Commands with an esxcfg Prefix
Command with
vicfg prefix
Command with
esxcfg prefix See
vicfg-advcfg esxcfg-advcfg AdvancedManagementwithvicfgadvcfgonpage 46.
vicfg-cfgbackup esxcfg-cfgbackup ConfigurationInformationBackupwithvicfgcfgbackuponpage 39.
vicfg-dns esxcfg-dns DNSConfigurationSpecificationwithvicfgdnsonpage 31.
vicfg-dumppart esxcfg-dumppart DiagnosticPartitionManagementwithvicfgdumppartonpage 25.
vicfg-module esxcfg-module VMkernelModuleManipulationwithvicfgmoduleonpage 47.
vicfg-mpath esxcfg-mpath BasicStorageArrayManagementwithvicfgmpathonpage 27.
vicfg-nas esxcfg-nas NASFileSystemManagementwithvicfgnasonpage 28.
vicfg-nics esxcfg-nics PhysicalNICManagementwithvicfgnicsonpage 32.
vicfg-ntp esxcfg-ntp NTPServerSpecificationwithvicfgntponpage 33.
vicfg-rescan esxcfg-rescan RescanOperationswithvicfgrescanonpage 30.
vicfg-route esxcfg-route RouteEntryManipulationwithvicfgrouteonpage 34.
vicfg-scsidevs esxcfg-scsidevs AvailableLUNDiscoverywithvicfgscsidevsonpage 29.
vicfg-snmp esxcfg-snmp SNMPManagementwithvicfgsnmponpage 40.
vicfg-syslog esxcfg-syslog SyslogServerSpecificationwithvicfgsyslogonpage 41.
vicfg-vmknic esxcfg-vmknic VMkernelNICsManagementwithvicfgvmkniconpage 35.
vicfg-vswitch esxcfg-vswitch VirtualSwitchManagementwithvicfgvswitchonpage 36.
vSphere Command-Line Interface Installation and Reference Guide
24 VMware, Inc.
VMware, Inc. 25
2
vSphereCLIincludescommandsforstorage,network,system,andvirtualmachinemanagementdiscussed
here.Somecommandswithmanyoptionsarediscussedinseparatechapters.
Thischapterincludesthefollowingtopics:
StorageManagementCommandsonpage 25
NetworkingCommandsonpage 31
SystemManagementCommandsonpage 39
VirtualMachineManagementCommandsonpage 44
MiscellaneousManagementCommandsonpage 46
FileSystemManipulationwithvifsonpage 50
Storage Management Commands
Table 21liststhevSphereCLIstoragemanagementcommands.
Diagnostic Partition Management with vicfg-dumppart
Thevicfg-dumppartcommandqueries,sets,andscansanESX/ESXihostsdiagnosticpartitions.TheESX
ConfigurationGuideandtheESXiConfigurationGuidediscussdiagnosticpartitionsindetail.
vSphere CLI Reference 2
Table 2-1. Storage Management Commands
Command See
esxcli Chapter 6,StoragePathandStoragePluginManagementwithesxcli,onpage 83.
vicfg-dumppart DiagnosticPartitionManagementwithvicfgdumppartonpage 25.
vicfg-iscsi Chapter 4,iSCSIStorageManagementwithvicfgiscsi,onpage 63.
vicfg-mpath BasicStorageArrayManagementwithvicfgmpathonpage 27.
vicfg-nas NASFileSystemManagementwithvicfgnasonpage 28.
vicfg-rescan RescanOperationswithvicfgrescanonpage 30.
vicfg-scsidevs AvailableLUNDiscoverywithvicfgscsidevsonpage 29.
vmkfstools .Chapter 3,FileSystemManagementwithvmkfstools,onpage 53
vSphere Command-Line Interface Installation and Reference Guide
26 VMware, Inc.
Options
Table 22liststhecommandspecificoptionsforvicfg-dumppart.Youmustalsospecifyconnectionoptions.
SeevSphereCLIConnectionOptionsonpage 17.
Examples
Thefollowingexamplesforvicfg-dumppartrequireconnectionoptions,indicatedby<conn_options>.See
SpecifyingAuthenticationInformationonpage 13.
vicfg-dumppart.pl <conn_options> -t
ShowsthecurrentdiagnosticpartitiontheVMkerneluses.
vicfg-dumppart.pl <conn_options> -s naa.<naa_ID>
Setstheactivepartitiontonaa.<naa_ID>.Afterthecommandhasbeenrun,-treportsnaa.<naa_ID>asthe
activepartition.
vicfg-dumppart.pl <conn_options> -l
Displaysinformationonallpartitionsthatcanbeusedasdiagnosticpartitions.
vicfg-dumppart.pl <conn_options> -d
Deactivatesthediagnosticpartition.Afterthiscommandhasrun,nodiagnosticpartitionisset.
vicfg-dumppart.pl <conn_options> -f
Findsallpartitionsthatcouldbeusedasdiagnosticpartitionsanddisplaysdetailedinformation.Theoutput
mightlookasfollows.
Partition name on vml.mpx.vmhba36:C0:T0:L0:7 -> mpx.vmhba36:C0:T0:L0:7
Table 2-2. Options for vicfg-dumppart
Option Description
--activate <partition>
-a <partition>
Makesthespecifiedpartitionthecurrentdiagnosticpartition.
Thisoptionhasthesameeffectas--set.
--deactivate [<partition>]
-d [<partition>]
Deactivatestheactivediagnosticpartition.Theoptionalsounsetsthediagnostic
partition.Specifyingthenameofthepartitionisoptional.
WARNING:Ifyourunvicfg-dumppartwiththisoption,yoursystemcannotwrite
errorstoafileuntilanotherpartitionisactivated.Youloseanyerrorrecordiferrors
occur.
--find
-f
FindsalldiagnosticpartitionsontheESX/ESXihostandprintsthem.Thepartitions
caninclude,inorderofsuitability,paralleladapter,blockadapter,FibreChannel,
hardwareiSCSI,softwareiSCSIpartitions.
--get-active
-t
Displaystheactivediagnosticpartitionforthissystem.Runningvicfg-dumppart
withthisoptionreturnstheinternalnameofthepartition(vmbhaX:X:X:X)ornone
ifnopartitionisset.
--list
-l
ListsallpartitionsontheESX/ESXisystemthathavetheappropriatepartitiontype
toactasadiagnosticpartition.
CAUTION:ExecutionmighttakeseveralminutesandslowdownyourESX/ESXi
hostbecausethecommandscansallLUNsonthesystem.
--set vmbha<partition>
-s vmbha<partition>
Setsandactivatesthediagnosticpartition,whichyoumustspecifyusingnaa.xxx:1
oreui.xxxsyntax.
--vihost <host>
-h <host
WhenyourunavSphereCLIcommandwiththe--serveroptionpointingtoa
vCenterServersystem,use--vihosttospecifytheESX/ESXihosttorunthe
commandagainst.
VMware, Inc. 27
Chapter 2 vSphere CLI Reference
Basic Storage Array Management with vicfg-mpath
Thevicfg-mpathcommandsupportslistinginformationaboutFibreChanneloriSCSILUNsandchanging
apathsstate.Usetheesxclicommandformanagingpluggablestoragearchitecture(PSA)andnative
multipathing(NMP),includingpathpolicymodification.SeeStoragePathandStoragePluginManagement
withesxclionpage 83.
NamesofvirtualmachineHBAsarenotguaranteedtobevalidacrossreboots.Useindustrystandarddevice
names,withformateui.xxxandnaa.xxxtobesureofconsistency.DonotuseVMLLUNnamesunlessdevice
namesarenotavailable.
Options
Table 23liststhecommandspecificoptionsforvicfg-mpath.Youmustalsospecifyconnectionoptions.See
Table 12,vSphereCLIConnectionOptions,onpage 17.
Examples
Thefollowingexamplesforvicfg-mpathrequireconnectionoptions.TheservermustbeanESX/ESXi4.x
host.SeeSpecifyingAuthenticationInformationonpage 13.
vicfg-mpath.pl <conn_options> --state off --path vmhba32:C0:T1:L0
Setsthestateforaspecificpath.Requiresthat--pathisspecified.
IMPORTANTThiscommandisavailableonlyforESX/ESXi4.0orlater.Usethevicfg-mpath35commandto
performstoragemanagementonESX/ESXi3.5hosts.SeeStorageArrayConfigurationfor
VMware Infrastructure 3.5Systemswithvicfgmpath35onpage 99.
Table 2-3. Options for vicfg-mpath
Option Description
--device
-d
Usedwiththe--listoptiontodisplayonlyaspecificdevice.
--list [-P | -d]
-l [-P | -d]
Listsdetailedpathinformationforthespecifiedpathordevice.
--list-compact [-P | -d]
-L [-P | -d]
Presentsashortlistingofallpaths.
--list-map [-P | -d]
-m [-P | -d]
Listsallpathsandthecorrespondingadaptersanddevicemappings.
--list-paths [-P | -d]
-b [-P | -d]
Listsalldevicesandthecorrespondingpaths.
--list-plugins [-P | -d]
-G [-P | -d]
Listsallmultipathingpluginsloadedintothesystem.Ataminimum,this
commandreturnsNMP(NativeMultipathingPlugin).IfotherMPPpluginshave
beenloaded,theyarelistedaswell.Forinformationaboutstoragearrayplugins,
seetheESXConfigurationGuideandtheESXiConfigurationGuide.SeeChapter 6,
StoragePathandStoragePluginManagementwithesxcli,onpage 83forplugin
managementcommands.
--path
-P
Usedwithlistcommandstodisplayonlyinformationforaspecificpath.Thepath
namecanbethelongpathUIDortheshorterruntimenameofthepath.
--state [active|off]
-s [active|off]
SetsthestateofagivenLUNpathtoeitheractiveoroff.
Thisoptionrequiresthatthe--pathoptionsissetandspecifieseitherthepathUID
orthepathruntimename.
Ifyouarechangingapathsstate:
ThechangeoperationfailsifI/Oisactivewhenthepathsettingischanged.
Reissuethecommand.
YoumustissueatleastoneI/Ooperationbeforethechangetakeseffect.
--vihost <host>
-h <host>
WhenyourunavSphereCLIcommandwiththe--serveroptionpointingtoa
vCenterServersystem,use--vihosttospecifytheESX/ESXihosttorunthe
commandagainst.
vSphere Command-Line Interface Installation and Reference Guide
28 VMware, Inc.
vicfg-mpath.pl <conn_options> -m
Listsallpathswithadapteranddevicemappings.
vicfg-mpath.pl <conn_options> -l
Listsallpathsonthesystemwiththeirdetailedinformation.
vicfg-mpath.pl <conn_options> -l -P vmhba32:C0:T0:L0
Listsdetailedinformationaboutthepathspecifiedby-P.Youcanspecifythepathusingtheruntimenameor
thefirstiteminthevicfg-mpath -ldisplay.Seetheprecedingexampleforvicfg-mpath -l.
vicfg-mpath.pl <conn_options> -l -d mpx.vmhba32:C0:T1:L0
Listsdetailedinformationforthepathsforthedevicespecifiedin-d.
NAS File System Management with vicfg-nas
Thevicfg-nascommandmanipulatesNASfilesystemsassociatedwithESX/ESXisystems.Formore
informationonworkingwithNASfilesystems,seetheESXConfigurationGuideandtheESXiConfiguration
Guide.
Options
Table 24listscommandspecificoptionsforvicfg-nas.Youmustalsospecifyconnectionoptions.See
vSphereCLIConnectionOptionsonpage 17.
Examples
Thefollowingexamplesforvicfg-nasrequireconnectionoptions.SeeSpecifyingAuthentication
Informationonpage 13.
vicfg-nas.pl <conn_options> -l
ListsallknownNASfilesystemswiththeirmountname,sharename,andhostname.Indicatesforeachfile
systemwhetheritismounted.
vicfg-nas.pl <conn_options> -a
AddsanewNASfilesystemtotheESX/ESXihost.ThiscommandaddsanentrytotheknownNASfilesystem
list.
Table 2-4. Options for vicfg-nas
Option Description
--add <name>
-a <name>
AddsanewNASfilesystemtotheESX/ESXihost.
Whenyouusethisoption,youmustalsousethe-oand-soptions,andmustspecifya
labelnameforthenewfilesystem.
--delete <name>
-d <name>
DeletesaNASfilesystem.
ThiscommandunmountstheNASfilesystemandremovesitfromthelistofknownfile
systems.
--list
-l
ListsallknownNASfilesystemswiththeirmountname,sharename,andhostnameand
indicatesforeachfilesystemwhetheritismounted.
--nasserver <n_host>
-o <n_host>
Usedwiththe-aoptiontosupplythehostnameforanewNASfilesystem.
--readonly
-y
AddsthenewNASfilesystemwithreadonlyaccess.
--share <share>
-s <share>
Usedwiththe-aoptiontosupplythesharenameforanewNASfilesystem.
--vihost <host>
-h <host>
WhenyourunavSphereCLIcommandwiththe--serveroptionpointingtoavCenter
Serversystem,use--vihosttospecifytheESX/ESXihosttorunthecommandagainst.
VMware, Inc. 29
Chapter 2 vSphere CLI Reference
vicfg-nas.pl <conn_options> -d
DeletesaNASfilesystem.ThiscommandunmountstheNASfilesystemandremovesitfromthelistofknown
filesystems.
vicfg-nas.pl <conn_options> -a -s new_share
AddsanewNASfilesystemtotheESX/ESXihost.ThiscommandaddsanentrytotheknownNASfilesystem
listandsuppliesthesharenameofthenewNASfilesystem.
Available LUN Discovery with vicfg-scsidevs
Thevicfg-scsidevscommanddisplaysinformationaboutavailableLUNsonESX/ESXi 4.0hosts.
Youcanrunvicfg-scsidevs --queryandvicfg-scsidevs --vmfsagainstESX/ESXiversion3.5.The
otheroptionsaresupportedonlyagainstESX/ESXiversion4.0.
Inpreviousreleasesofthiscommandlineinterface,thecorrespondingcommandisvicfg-vmhbadevs.
Options
Youcanrunvicfg-scsidevswiththefollowingoptions.Foradditionaloptions,seevSphereCLI
ConnectionOptionsonpage 17.
Examples
Thefollowingexamplesforvicfg-scsidevsrequireconnectionoptions.SeeSpecifyingAuthentication
Informationonpage 13.
vicfg-scsidevs.pl <conn_options> -l
Listsdetailedinformationaboutalllogicaldevicesonthissystem.Hereistheoutputforjustonedevice;the
actuallistingincludesmultipledevices.
mpx.vmhba2:C0:T1:L0
Device Type: cdrom
Size: 0 MB
Display Name: Local SONY CD-ROM (mpx.vmhba2:C0:T1:L0)
Plugin: NMP
Table 2-5. Options for vicfg-scsidevs
Option Description
--compact-list
-c
Listsalllogicaldevices,eachonasingleline,withlimitedinformation.Theinformation
includesthedeviceID,devicetype,size,andpluginanddevicedisplayname.
Youcanspecifythe--deviceoptiontolistinformationaboutaspecificdevice.
--device <device>
-d <device>
Usedwithotheroptionstospecifythedeviceforwhichyouwantinformation.
--hba-device-list
-A
ForeachHBA,printsamappingbetweentheHBAandthedevicesforwhichitprovidespaths.
--hbas
-a
PrintsHBAdeviceswithidentifyinginformation.ThisincludestheadapterID,driverID,
adapterUID,PCI,vendor,andmodel.
--list
-l
Listsdeviceinformationforalllogicaldevicesonthissystem.Theinformationincludesthe
name(UUID),devicetype,displayname,andmultipathingplugin.
Youcanspecifythe--deviceoptiontolistinformationaboutaspecificdevice.
--query
-q
Printsmappingsin2.5compatibilitymodetomimicacalltovmkpcidivy -q vmhba_devs.
--uids
-u
ListstheprimaryUIDforeachdeviceandanyotherUIDs(aliases)foreachUID.
Youcanspecifythe--deviceoptiontolistinformationaboutaspecificdevice.
--vihost <host>
-h <host>
WhenyourunavSphereCLIcommandwiththe--serveroptionpointingtoavCenterServer
system,use--vihosttospecifytheESX/ESXihosttorunthecommandagainst.
--vmfs
-m
PrintsmappingsforeachVMFSvolumetoitscorrespondingpartition,pathtothatpartition,
VMFSUUID,extentnumberandvolumenames.
vSphere Command-Line Interface Installation and Reference Guide
30 VMware, Inc.
Console Device: /vmfs/devices/genscsi/mpx.vmhba2:C0:T1:L0
Devfs Path: /vmfs/devices/genscsi/mpx.vmhba2:C0:T1:L0
Vendor: SONY Model: DVD RW AW-Q170A Revis: 1.70
SCSI Level: 5 Is Pseudo: Status:
Is RDM Capable: Is Removable:
Other Names:vml.000N000000NNNdNNNNNNNNaNNNaNN
vicfg-scsidevs.pl <conn_options> -c
Listsabbreviatedinformationaboutalllogicaldevicesonthissystem.
vicfg-scsidevs.pl <conn_options> -u
Listsalldeviceuniqueidentifierswiththeirprimaryname.
vicfg-scsidevs.pl <conn_options> -l -d mpx.vmhba32:C0:T1:L0
Listsdetailedinformationforaspecificlogicaldevice.
vicfg-scsidevs.pl <conn_options> -m
PrintsmappingsforVMFSvolumestothecorrespondingpartition,pathtothatpartition,VMFSUUID,extent
numberandvolumenames.
vicfg-scsidevs.pl <conn_options> -a
PrintsHBAdeviceswithidentifyinginformation.
vicfg-scsidevs.pl <conn_options> -A
PrintsamappingbetweenHBAsandthedevicestheyprovidepathsto.
Rescan Operations with vicfg-rescan
Youcanusevicfg-rescanorthevSphereClienttoperformarescan.Performarescanoperationeachtime
youreconfigureyourstoragesetup.SeetheESXConfigurationGuideandtheESXiConfigurationGuide.The
FibreChannelSANConfigurationGuidediscussesrescanonFibreChannelstorage.TheiSCSISANConfiguration
GuidediscussesrescanoniSCSIstorage.
WhenyourescananESX/ESXihost,thecommandreturnsonlyanindicationofsuccessorfailureandno
detailedinformation.
Options
Table 26liststhecommandspecificoptionsforvicfg-rescan.Youmustalsospecifyconnectionoptions.See
vSphereCLIConnectionOptionsonpage 17.
Example
Thefollowingexampleforvicfg-rescanrequiresconnectionoptions.SeeTable 12,vSphereCLI
ConnectionOptions,onpage 17.
vicfg-rescan.pl <conn_options> vmbha0
Scansvmhba0andresultsinoutputlikethefollowing:
Scan operation succeeded
Table 2-6. Options for vicfg-rescan
Option Description
<vmkernel_SCSI_adapter_name> Nameoftheadaptertoscan,forexample,vmhba0.
--vihost <host>
-h <host>
WhenyourunavSphereCLIcommandwiththe--serveroptionpointingtoa
vCenterServersystem,use--vihosttospecifytheESX/ESXihosttorunthe
commandagainst.
VMware, Inc. 31
Chapter 2 vSphere CLI Reference
Networking Commands
Table 27listsvSphereCLInetworkingcommands.ForanintroductiontovSpherenetworking,seethe
networkingchaptersintheESXConfigurationGuideandtheESXiConfigurationGuide.
DNS Configuration Specification with vicfg-dns
Thevicfg-dnscommandlistsandspecifiestheDNSconfigurationofyourESX/ESXihost.Callthecommand
withoutcommandspecificoptionstolisttheexistingDNSconfiguration.
IfyouattempttochangethehostordomainnameortheDNSserveronhoststhatuseDHCP(dynamichost
protocol),anerrorresults.
Options
Table 28liststhecommandspecificoptionsforvicfg-dns.Youmustalsospecifyconnectionoptions.See
vSphereCLIConnectionOptionsonpage 17.
Examples
Thefollowingexamplesforvicfg-dnsrequireconnectionoptions.SeeSpecifyingAuthentication
Informationonpage 13.
vicfg-dns.pl <conn_options> -n dns_host_name
Configuresthehostnameforthespecifiedserver.
Table 2-7. vSphere CLI Networking Commands
Command See
vicfg-dns DNSConfigurationSpecificationwithvicfgdnsonpage 31
vicfg-nics PhysicalNICManagementwithvicfgnicsonpage 32
vicfg-ntp NTPServerSpecificationwithvicfgntponpage 33
vicfg-route RouteEntryManipulationwithvicfgrouteonpage 34
vicfg-vmknic VMkernelNICsManagementwithvicfgvmkniconpage 35
vicfg-vswitch VirtualSwitchManagementwithvicfgvswitchonpage 36
esxcli swiscsi nic UsingesxcliswiscsinicforNICBindingonpage 90
Table 2-8. Options for vicfg-dns
Option Description
--dhcp yes|no
-H yes|no
SpecifieswhetherornottheESX/ESXihostshoulduseDHCPtodetermineDNS
configuration.Youmustspecifyyesorno.
--dns <server_list>
-D <server_list>
DNSserverorserverstobeused.SpecifyacommaseparatedlistofDNSservers,in
orderofpreference.
--domain <d_name>
-d <d_name>
DomainnameportionforthisESX/ESXihost.Forexample,comp-xyz.com.
--hostname <h_name>
-n <h_name>
HumanreadablehostnameportionoftheDNSname.Forexample,esx01.
--vihost
-h
WhenyourunavSphereCLIcommandwiththe--serveroptionpointingtoa
vCenterServersystem,use--vihosttospecifytheESX/ESXihosttorunthe
commandagainst.
--vnic <v_nic>
-V <v_nic>
ThevirtualnetworkadaptertousewhenoverridingthesystemDNS.
Thisoptionisrequiredwhen--dhcpisyes.ForESXhosts,v_nicmustbeoneof
theserviceconsolenetworkadapters.ForESXihosts,v_nicmustbeoneofthe
VMkernelnetworkadapter.
ThespecifiedvirtualnetworkadaptermusthaveDHCPconfigured.
vSphere Command-Line Interface Installation and Reference Guide
32 VMware, Inc.
vicfg-dns.pl <conn_options> -d mydomain.biz
Configuresthedomainnameforthespecifiedserver.
vicfg-dns.pl <conn_options> -H yes
SpecifiesthatthehostshoulduseDHCPtodeterminetheDNSconfiguration.
vicfg-dns.pl <conn_options>
DisplaysDNSpropertiesforthespecifiedserver.Theinformationincludesthehostname,domainname,
DHCPsetting(trueorfalse),andDNSserversontheESX/ESXihost.Forexample:
Host Name localhost
Domain Name localdomain
DHCP true
DNS Servers 10.NN.NNN.1
10.NN.NNN.2
Physical NIC Management with vicfg-nics
Thevicfg-nicscommandmanagesphysicalNICs(uplinkadapters),thatis,theEthernetswitchesusedby
anESX/ESXihost.
Youcanusevicfg-nicstolistinformationandtospecifyspeedandduplexsettingforaNIC.
Options
Table 29liststhecommandspecificoptionsforvicfg-nics.Youmustalsospecifyconnectionoptions.See
vSphereCLIConnectionOptionsonpage 17.
Examples
Thefollowingexamplesforvicfg-nicsrequireconnectionoptions.SeeSpecifyingAuthentication
Informationonpage 13.
vicfg-nics.pl <conn_options> -d full -s 100 vmnic0
Setstheduplexsettingofvmnic0tofullandthespeedto100.
vicfg-nics.pl <conn_options> -a vmknic2
Setsvmknic2toautonegotiateitsspeedandduplexsettings.
vicfg-nics.pl <conn_options> -l
ListstheNICsinthesystem,andprintstheircurrentandconfiguredspeedandduplexsetting.
Table 2-9. Options for vicfg-nics
Option Description
--auto
-a
Setsthespecifiednetworkadaptertoautonegotiateitsspeedandduplexsettings.
--duplex [full|half] <nic>
-d [full|half] <nic>
Setstheduplexvalueatwhichagivennetworkadaptershouldruntoeitherfull
(transmitdatainbothdirectionsatthesametime)orhalf(transmitdatainone
directionatatime).
--list
-l
ListsthenetworkadaptersVMkernelname,itsPCIID,driver,linkstate,speed,
duplexsetting,andashortPCIdescriptionofthecard.
--speed <speed> <nic>
-s <speed> <nic>
Setsthespeedatwhichagivennetworkadaptershouldrun.Validvaluesfor
<speed>are10,100,1000,or10000.
--vihost <host>
-h <host>
WhenyourunavSphereCLIcommandwiththe--serveroptionpointingtoa
vCenterServersystem,use--vihosttospecifytheESX/ESXihosttorunthe
commandagainst.
VMware, Inc. 33
Chapter 2 vSphere CLI Reference
Thesystemreturnsatablethatincludesthename,PCI,driver,linkspeed,duplexMTU,anddescription
information,forexample: