vSphere SDK for Perl Programming Guide - Documentation - VMware
vSphere SDK for Perl Programming Guide - Documentation - VMware
vSphere SDK for Perl Programming Guide - Documentation - VMware
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Chapter 1 Getting Started with <strong>vSphere</strong> <strong>SDK</strong> <strong>for</strong> <strong>Perl</strong><br />
Using a configuration file is useful <strong>for</strong> repeatedly entering connection details. If you have multiple<br />
vCenter Server or ESX/ESXi systems and you administer each system individually, you can create multiple<br />
configuration files with different names. When you want to run a command or a set of commands on a server,<br />
you pass in the --config option with the appropriate filename at the command line.<br />
Using Microsoft Windows Security Support Provider Interface (SSPI)<br />
You can use the --passthroughauth command‐line argument to log in to a vCenter Server system (vCenter<br />
Server version 2.5 Update 2 or later). Using --passthroughauth passes the credentials of the executing user<br />
to the server. If the executing user is known by both the machine from which you access the vCenter Server<br />
system and the machine running the vCenter Server system, no additional authentication is required.<br />
NOTE Using SSPI is supported only when you run commands from Windows, and use a vCenter Server<br />
system as the target server.<br />
If <strong>SDK</strong> commands and the vCenter Server system run on the same machine, a local account <strong>for</strong> the executing<br />
user works. If they run on different machines, then the executing user must have an account in a domain<br />
trusted by both machines.<br />
SSPI supports a number of protocols. By default, it selects the Negotiate protocol, which indicates that client<br />
and server attempt to find a mutually supported protocol. Alternatively, you can use<br />
--passthroughauthpackage to specify another protocol supported by SSPI. Kerberos, the Windows<br />
standard <strong>for</strong> domain‐level authentication, is commonly chosen.<br />
If the vCenter Server system is configured to accept only a specific protocol, specifying the protocol to <strong>vSphere</strong><br />
<strong>SDK</strong> <strong>for</strong> <strong>Perl</strong> commands with --passthroughauthpackage might be required <strong>for</strong> successful authentication<br />
to the server. If you use --passthroughauth, you do not have to specify authentication in<strong>for</strong>mation in any<br />
other way. For example, to run connect.pl on the server, you can use the following command at the<br />
command line.<br />
--passthroughauth<br />
See the Microsoft Web site <strong>for</strong> a detailed discussion of SSPI.<br />
The following example connects to a server that has been set up to use SSPI. When you run the command, the<br />
system calls vminfo.pl with the --vmname option. The system does not prompt <strong>for</strong> a user name and password<br />
because the current user is known to the server.<br />
vminfo.pl --server --passthroughauth --passthroughauthpackage “Kerberos”<br />
--vihost my_esx --vmname <br />
Common Options Reference<br />
Table 1‐3 lists options that are available <strong>for</strong> all <strong>vSphere</strong> <strong>SDK</strong> <strong>for</strong> <strong>Perl</strong> scripts. Use the parameter on the<br />
command line and the variable or the parameter in configuration files.<br />
Table 1-3. Options Available <strong>for</strong> all <strong>vSphere</strong> <strong>SDK</strong> <strong>for</strong> <strong>Perl</strong> Scripts<br />
Parameter and Environment<br />
Variable Description<br />
--config <br />
VI_CONFIG=<br />
--credstore <br />
VI_CREDSTORE<br />
--encoding <br />
VI_ENCODING=<br />
Uses the <strong>vSphere</strong> <strong>SDK</strong> <strong>for</strong> <strong>Perl</strong> configuration file at the specified location.<br />
Important: You must specify a path that is readable from the current directory.<br />
Name of a credential store file. Defaults to<br />
/.vmware/credstore/vicredentials.xml on Linux and<br />
/<strong>VMware</strong>/credstore/vicredentials.xml on Windows. Commands<br />
<strong>for</strong> setting up the credential store are included in the <strong>vSphere</strong> <strong>SDK</strong> <strong>for</strong> <strong>Perl</strong>, which<br />
is installed with the <strong>vSphere</strong> CLI. The <strong>vSphere</strong> <strong>SDK</strong> <strong>for</strong> <strong>Perl</strong> <strong>Programming</strong> <strong>Guide</strong><br />
explains how to use the credential store.<br />
Specifies the encoding to be used. One of cp936 (Simplified Chinese), ISO-8859-1<br />
(German), or Shift_JIS (Japanese).<br />
You can use --encoding to specify the encoding <strong>vSphere</strong> <strong>SDK</strong> <strong>for</strong> <strong>Perl</strong> should map<br />
to when it is run on a <strong>for</strong>eign language system.<br />
<strong>VMware</strong>, Inc. 15