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 or VIX_SERVICEPROVIDER_VMWARE_WORKSTATION.
hostName
DNS name or IP address of remote host. Use undef to connect to local host.
hostPort
TCP/IP port of remote host, typically 902. Use zero for local host.
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.

$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_SERVER,
                                  undef, # hostName
                                  0, # hostPort
                                  undef, # userName
                                  undef, # 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 VMware, Inc. All rights reserved.