VMware, Inc. 15
Chapter 1 Getting Started with vSphere SDK for Perl
Usingaconfigurationfileisusefulforrepeatedlyenteringconnectiondetails.Ifyouhavemultiple
vCenter ServerorESX/ESXisystemsandyouadministereachsystemindividually,youcancreatemultiple
configurationfileswithdifferentnames.Whenyouwanttorunacommandorasetofcommandsonaserver,
youpass
inthe--configoptionwiththeappropriatefilenameatthecommandline.
Using Microsoft Windows Security Support Provider Interface (SSPI)
Youcanusethe--passthroughauthcommand‐lineargumenttologintoavCenterServersystem(vCenter
Serverversion2.5Update2orlater).Using--passthroughauthpassesthecredentialsoftheexecutinguser
totheserver.Iftheexecutinguserisknownbyboththemachinefromwhichyouaccessthe
vCenterServer
systemandthemachinerunningthevCenterServersystem,noadditionalauthenticationisrequired.
IfSDKcommandsandthevCenterServersystemrunonthesamemachine,alocalaccountfortheexecuting
userworks.Iftheyrunondifferentmachines,thentheexecutingusermusthavean
accountinadomain
trustedbybothmachines.
SSPIsupportsanumberofprotocols.Bydefault,itselectstheNegotiateprotocol,whichindicatesthatclient
andserverattempttofindamutuallysupportedprotocol.Alternatively,youcanuse
--passthroughauthpackagetospecifyanotherprotocolsupportedbySSPI.Kerberos,theWindows
standardfor
domain‐levelauthentication,iscommonlychosen.
IfthevCenterServersystemisconfiguredtoacceptonlyaspecificprotocol,specifyingtheprotocoltovSphere
SDKforPerlcommandswith --passthroughauthpackagemightberequiredforsuccessfulauthentication
totheserver.Ifyouuse--passthroughauth,youdonothavetospecifyauthentication
informationinany
otherway.Forexample,torunconnect.plontheserver,youcanusethefollowingcommandatthe
commandline.
<command> <login_params> --passthroughauth
SeetheMicrosoftWebsiteforadetaileddiscussionofSSPI.
ThefollowingexampleconnectstoaserverthathasbeensetuptouseSSPI.Whenyourunthecommand,the
systemcallsvminfo.plwiththe--vmnameoption.Thesystemdoesnotpromptforausernameandpassword
because
thecurrentuserisknowntotheserver.
vminfo.pl --server <vc_server> --passthroughauth --passthroughauthpackage “Kerberos”
--vihost my_esx --vmname <name>
Common Options Reference
Table 1‐3listsoptionsthatareavailableforallvSphereSDKforPerlscripts.Usetheparameteronthe
commandlineandthevariableortheparameterinconfigurationfiles.
N
OTEUsingSSPIissupportedonlywhenyouruncommandsfromWindows,anduseavCenterServer
systemasthetargetserver.
Table 1-3. Options Available for all vSphere SDK for Perl Scripts
Parameter and Environment
Variable Description
--config <config_file>
VI_CONFIG=<config_file>
UsesthevSphereSDKforPerlconfigurationfileatthespecifiedlocation.
Important:Youmustspecifyapaththatisreadablefromthecurrentdirectory.
--credstore <credstore>
VI_CREDSTORE
Nameofacredentialstorefile.Defaultsto
<HOME>/.vmware/credstore/vicredentials.xmlonLinuxand
<APPDATA>/VMware/credstore/vicredentials.xmlonWindows.Commands
forsettingupthecredentialstore
areincludedinthevSphereSDKforPerl,which
isinstalledwiththevSphereCLI.ThevSphereSDKforPerlProgrammingGuide
explainshowtousethecredentialstore.
--encoding <encoding>
VI_ENCODING=<encoding>
Specifiestheencodingtobeused.Oneofcp936(SimplifiedChinese),ISO-8859-1
(German),orShift_JIS(Japanese).
Youcanuse--encoding
tospecifytheencodingvSphereSDKforPerlshouldmap
towhenitisrunonaforeignlanguagesystem.