6.0

Table Of Contents
Getting Started with vSphere Command-Line Interfaces
30 VMware, Inc.
vicfg-nics -l --username <sso_username> --password "<admin_pwd>" --server <vc_HOSTNAME_OR_IP>
--psc <psc_HOSTNAME_OR_IP> --vihost <esxi_HOSTNAME_OR_IP>
UsingasessionfileresultsinlessoverheadandbetterperformancethanconnectingtothePlatformServices
Controllerrepeatedly.
Authenticating Directly to the Host
vCLIoffersseveraloptionsforauthenticatingdirectlytothehost.
Using a Session File
Youcancreateasessionfilewiththesave_sessionscript.Thescriptisinthe/apps/sessiondirectoryof
thevSphereSDKforPerl,whichisincludedinthevCLIpackage.Youcanusethesessionfile,whichdoesnot
revealpasswordinformation,whenyourunvCLIcommands.Ifthesessionfile
isnotusedfor30 minutes,it
expires.
Ifyouuseasessionfile,otherconnectionoptionsareignored.
To create and use a session file
1 Connecttothedirectorywherethescriptislocated.
Forexample:
2Runsave_session.
Youcanusethesave_session.plscriptorthe--savesessionfileoptiontothevCLIcommand.You
mustspecifytheserver
toconnecttoandthenameofasessionfileinwhichthescriptsavesan
authenticationcookie.
save_session --savesessionfile <location> --server <server>
Forexample:
Ifyouspecifyaserver,butnousernameorpassword,thescriptpromptsyou.
3WhenyourunvCLIcommands,passinthesessionfileusingthe
--sessionfileoption.
<command> --sessionfile <sessionfile_location> <command_options>
Forexample:
Using Environment Variables
OnLinux,youcansetenvironmentvariablesinaLinuxbashprofileoronthecommandlinebyusinga
commandlikethefollowing:
export VI_SERVER=<your_server_name_or_address>
Windows:
cd C:\Program Files\VMware\VMware vSphere CLI\Perl\apps\session
Linux:
cd /usr/share/lib/vmware-vcli/apps/session
Windows:
save_session.pl --savesessionfile C:\Temp\my_session --server my_server
--username <username> --password <password>
Linux:
save_session --savesessionfile /tmp/vimsession --server <servername_or_address>
--username <username> --password <password>
Windows:
esxcli --sessionfile C:\Temp\my_session network ip interface list
vicfg-mpath.pl --sessionfile C:\Temp\my_session --list
Linux:
esxcli --sessionfile /tmp/vimsession network ip interface list
vicfg-mpath --sessionfile /tmp/vimsession --list