Name

HostConnect

Description

($err, $hostHandle) = HostConnect($apiVersion,
                                  $hostType,
                                  $hostName,
                                  $hostPort,
                                  $userName,
                                  $password,
                                  $options,
                                  $propertyListHandle);

Creates a host handle.

Parameters

apiVersion
Must be VIX_API_VERSION.
hostType
VIX_SERVICEPROVIDER_VMWARE_SERVER for VMware Server 1.x, VIX_SERVICEPROVIDER_VMWARE_WORKSTATION for Workstation 6.x, or VIX_SERVICEPROVIDER_VMWARE_VI_SERVER for VMware Server 2.x.
hostName
DNS name, IP address, or URL of the remote host. For VMware Server 1.x, use a DNS name or IP address. For VMware Server 2.x, use a URL of the form "https://<hostName>:<port>/sdk" where <hostName> could be DNS name or IP address. Use undef to connect to local host.
hostPort
TCP/IP port of remote host. Use zero for local host. On VMware Server 2.x you must specify port number within the hostName parameter, so this parameter is ignored.
userName
Username to authenticate with on remote machine. Use undef to authenticate as current user on local host.
password
Password to authenticate with on remote machine. Use undef to authenticate as current user on local host.
options
must be 0.
propertyListHandle
Must be VIX_INVALID_HANDLE.

Return Value

$err. The error code returned by the operation. For returned values, see Topics > Error Codes.

$hostHandle. A handle to host.

Remarks

Side Effects

None.

Requirements

use VMware::Vix::Simple;
use VMware::Vix::API::Constants;
since VMware Server 1.0

Example

use VMware::Vix::Simple;
use VMware::Vix::API::Constants;

my $err = VIX_OK;
my $hostHandle = VIX_INVALID_HANDLE;

($err, $hostHandle) = HostConnect(VIX_API_VERSION,
                                  VIX_SERVICEPROVIDER_VMWARE_VI_SERVER,
                                  "https://viserver/sdk", # hostName
                                  0, # hostPort
                                  "root", # userName
                                  "rootpasswd", # password
                                  0, # options
                                  VIX_INVALID_HANDLE); # propertyListHandle

die "HostConnect() failed, $err ", GetErrorText($err), "\n" if $err != VIX_OK;
# ...Do everything in your program...
HostDisconnect($hostHandle);

Copyright (C) 2007-2008 VMware, Inc. All rights reserved.