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
Operating System Command
Windows
cd C:\Program Files\VMware\VMware vSphere CLI\Perl\apps\session
Linux
cd /usr/share/lib/vmware-vcli/apps/session
2 Run save_session.
You can use the save_session.pl script or the --savesessionfile option to the vCLI command. You
must specify the server which to connect to and the name of a session le in which the script saves an
authentication cookie.
save_session --savesessionfile <location> --server <server>
For example.
Operating System Command
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>
N If you specify a server, but no user name or password, the script prompts you.
3 When you run vCLI commands, pass in the session le using the --sessionfile option.
<command> --sessionfile <sessionfile_location> <command_options>
For example.
Operating System Command
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
Using Environment Variables
How you use environment variables depends on the operating system that you are using.
On Linux, you can set environment variables in a Linux bash prole or on the command line by using a
command like the following.
export VI_SERVER=<your_server_name_or_address>
On Windows, you can set environment variables in the Environment properties dialog box of the System
control panel. For the current session, you can set environment variables at the command line by using a
command like the following.
set VI_SERVER=<your_server_name_or_address>
I Do not use escape characters in environment variables.
See “Using vCLI Commands in Scripts,” on page 42 for an environment variable example.
Chapter 4 Running vCLI Host Management Commands
VMware, Inc. 35