6.5
Table Of Contents
- Getting Started with vSphere Command-Line Interfaces
- Contents
- About This Book
- Managing vSphere with Command-Line Interfaces
- Installing vCLI
- Running Host Management Commands in the ESXi Shell
- Running vCLI Host Management Commands
- Overview of Running vCLI Host Management Commands
- Protecting Passwords
- Authenticating Through vCenter Server and vCenter Single Sign-On
- Authenticating Directly to the Host
- Trust Relationship Requirement for ESXCLI Commands
- Common Options for vCLI Host Management Command Execution
- Using vCLI Commands in Scripts
- Run Host Management Commands from a Windows System
- Run Host Management Commands from a Linux System
- Running DCLI Commands
- Index
Authenticating Through vCenter Server and vCenter Single Sign-On
For all ESXi hosts that are managed by a vCenter Server system that is integrated with vCenter Single Sign-
On 6.0 and later, you can authenticate directly to the vCenter Server system, or you can authorize to
vCenter Server through vCenter Single Sign-On.
The best practice is to authenticate through vCenter Single Sign-On. The vCenter Single Sign-On service is
included in the Platform Services Controller. The Platform Services Controller can be embedded in your
vCenter Server installation, or one Platform Services Controller can handle authentication, certicate
management, and some other tasks for multiple vCenter Server systems.
N You cannot use this approach if vCenter Server is integrated with vCenter Single Sign-On 5.0.
You use the --psc option and, optionally, the --server option.
n
psc - Species the Platform Services Controller instance associated with the vCenter Server system that
manages the host.
n
server - Species the vCenter Server system that manages the host. Required if the Platform Services
Controller instance is associated with more than one vCenter Server system.
n
vihost - Species the ESXi host, as in earlier versions of vCLI.
Examples
vicfg-nics -l --username <sso_username> --password "<admin_pwd>" --server <vc_HOSTNAME_OR_IP> --
psc <psc_HOSTNAME_OR_IP> --vihost <esxi_HOSTNAME_OR_IP>
esxcli --server vc_HOSTNAME_OR_IP> --vihost <esxi_HOSTNAME_OR_IP> --username USERNAME> --
password <PASSWORD> --psc <psc_HOSTNAME_OR_IP> hardware clock get
If the specied user is known to vCenter Single Sign-On, a session is created. You can save the session with
the --savesessionfile argument, and later use that session with the --sessionfile argument. For example,
you can save the session by running the following command.
vicfg-nics -l --username sso_username> --password "<admin_pwd>" --server vc_HOSTNAME_OR_IP> --
psc <psc_HOSTNAME_OR_IP> --vihost <esxi_HOSTNAME_OR_IP>
Using a session le results in less overhead and beer performance than connecting to the Platform Services
Controller repeatedly.
Authenticating Directly to the Host
vCLI oers several options for authenticating directly to the host.
Create and Use a Session File
You can create a session le with the save_session script.
The save_session script is in the /apps/session directory of the vSphere SDK for Perl, which is included in
the vCLI package. You can use the session le, which does not reveal password information, when you run
vCLI commands. If the session le is not used for 30 minutes, it expires.
If you use a session le, other connection options are ignored.
Procedure
1 Connect to the directory where the script is located.
For example.
Getting Started with vSphere Command-Line Interfaces
34 VMware, Inc.