Name

Connect

Description

HRESULT
Connect([in] LONG apiVersion,
        [in] LONG hostType,
        [in] BSTR hostName,
        [in] LONG hostPort,
        [in] BSTR userName,
        [in] BSTR password,
        [in] LONG options,
        [in] IVixHandle* propertyList,
        [in] ICallback* jobDoneCallback,
        [out,retval] IJob** connectJob);

Creates a host handle.

Parameters

apiVersion
Must be VixCOM.Constants.VIX_API_VERSION.
hostType
VixCOM.Constants.VIX_SERVICEPROVIDER_VMWARE_SERVER for VMware Server 1.x, VixCOM.Constants.VIX_SERVICEPROVIDER_VMWARE_WORKSTATION for Workstation 6.x, or VixCOM.Constants.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 NULL (C++), null (C#), or empty (VB) 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 NULL (C++), null (C#), or empty (VB) to authenticate as current user on local host.
password
Password to authenticate with on remote machine. Use NULL (C++), null (C#), or Empty (VB) to authenticate as current user on local host.
options
Optionally VixCOM.Constants.VIX_HOSTOPTION_USE_EVENT_PUMP (See Remarks section), otherwise zero.
propertyList
Must be NULL (C++), null (C#), or Nothing (VB).
jobDoneCallback
An ICallback instance that will be called when the operation is complete.
connectJob
Returns an IJob object that describes the state of this asynchronous operation.

Return Value

HRESULT

Remarks

Side Effects

None.

Requirements

VixCOM.h, since VMware Workstation 6.0.

Example


VBScript:
Dim lib
Dim job
Dim err
Dim host
Dim results

Set lib = CreateObject("VixCOM.VixLib")

Set results = Nothing

Set job = lib.Connect(VixCOM.Constants.VIX_API_VERSION, VixCOM.Constants.VIX_SERVICEPROVIDER_VMWARE_VI_SERVER, "https://viserver/sdk", 0, "Administrator", "adminpass", 0, Nothing, Nothing)
err = job.Wait(Array(VixCOM.Constants.VIX_PROPERTY_JOB_RESULT_HANDLE), results)
If lib.ErrorIndicatesFailure(err) Then
   ' Handle the error...
End If

Set host = results(0)

' ...Do everything in your program...

host.Disconnect()

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