Results 1 to 3 of 3

Thread: Vmware Sdk For vb6(VixCOM64.dll),vbs-CreateObject("VixCOM.VixLib")

  1. #1

    Thread Starter
    Taking a Break
    Join Date
    Jan 2020

    Vmware Sdk For vb6(VixCOM64.dll),vbs-CreateObject("VixCOM.VixLib")

    Need VMWare VIX Automation Tools and SDK

    'C:\Windows\SysWOW64\regsvr32.exe ***\VixCOM64.dll
    'Reference VixCOM64.dll TO vb6 Project
    Dim lib As VixCOM.VixLib
    Dim vmPath As String
    Private Sub Form_Load()
    vmPath = "***/Windows 7.vmx"
    ' Copyright 2006 VMware, Inc.
    ' All rights not expressly granted to you by VMware, Inc. are reserved.
    ' VixCOM VBScript Sample Script (powerOn)
    ' This demonstrates how to open a VM, power it on and power it off.
    ' This uses the Wait function to block after starting each
    ' asynchronous function. This effectively makes the asynchronous
    ' functions synchronous, because Wait will not return until the
    ' asynchronous function has completed.
    ' Instructions for Windows 2000 and later operating systems:
    '  - there should be an accompanying file named 'powerOn.wsf'
    '    It is placed in the same directory as this file during
    '    product installation. This file is responsible for setting
    '    up the Windows Script Host environment and loading the
    '    VixCOM type library, thereby enabling this script to
    '    reference symbolic constants such as VIX_API_VERSION
    '  - in a command line window, type:
    '    cscript //nologo powerOn.wsf
    Dim results
    'Dim lib
    Dim job
    Dim host
    Dim vm As IVM2
    Dim err
    Dim useWorkstation
    Dim hostType
    Dim hostName
    Dim hostUsername
    Dim hostPassword
    Dim poweronOption
    ' Certain arguments differ when using VIX with VMware Server 2.0 and
    ' VMware Workstation.
    ' Comment out this line to use this code with VMware Server 2.0.
    useWorkstation = 1
    If useWorkstation Then
       hostName = Empty
       hostUsername = Empty
       hostPassword = Empty
       'vmPath = "***/Windows 7.vmx"
       poweronOption = VixCOM.Constants.VIX_VMPOWEROP_LAUNCH_GUI '=512
       ' For VMware Server 2.0
       hostName = ""
       hostUsername = "Administrator"
       hostPassword = "password"
       vmPath = "[standard] winxppro/winxppro.vmx"
       poweronOption = VixCOM.Constants.VIX_VMPOWEROP_NORMAL
    End If
    Set lib = CreateObject("VixCOM.VixLib")
    ' Connect to the local installation of Workstation. This also intializes the VIX API.
    Set job = lib.Connect(VixCOM.Constants.VIX_API_VERSION, hostType, hostName, 0, hostUsername, hostPassword, 0, Nothing, Nothing)
    ' results needs to be initialized before it's used, even if it's just going to be overwritten.
    Set results = Nothing
    ' Wait waits until the job started by an asynchronous function call has finished. It also
    ' can be used to get various properties from the job. The first argument is an array
    ' of VIX property IDs that specify the properties requested. When Wait returns, the
    ' second argument will be set to an array that holds the values for those properties,
    ' one for each ID requested.
    err = job.Wait(Array(VixCOM.Constants.VIX_PROPERTY_JOB_RESULT_HANDLE), results)
    If err <> 0 Then QuitIfError (err)
    ' The job result handle will be first element in the results array.
    Set host = results(0)
    ' Open the virtual machine with the given .vmx file.
    Set job = host.OpenVM(vmPath, Nothing)
    err = job.Wait(Array(VixCOM.Constants.VIX_PROPERTY_JOB_RESULT_HANDLE), results)
    If CLng(err) <> 0 Then QuitIfError (err)
    Set vm = results(0)
    'MsgBox TypeName(vm)
    ' Power on the virtual machine we just opened. This will launch Workstation if it hasn't
    ' already been started.
    Set job = vm.PowerOn(poweronOption, Nothing, Nothing)
    ' WaitWithoutResults is just like Wait, except it does not get any properties.
    err = job.WaitWithoutResults()
    If CLng(err) <> 0 Then QuitIfError (err)
    'MsgBox "正在启动,启动完成后,点确定按钮"
    MsgBox "Doing Start Vmware virtual machine,When Start Successfull,CLICK OK BUTTON", vbOKOnly
    ' Here you would do any operations on the guest inside the virtual machine.
    ' Power off the virtual machine. This will cause Workstation to shut down if it
    ' was not running previous to the call to PowerOn.
    'If MsgBox("是否关闭?", vbYesNo) = vbYes Then
    If MsgBox("Do You Want to Close Vmware virtual machine?", vbYesNo) = vbYes Then
    Set job = vm.PowerOff(VixCOM.Constants.VIX_VMPOWEROP_NORMAL, Nothing)
    err = job.WaitWithoutResults()
    If CLng(err) <> 0 Then QuitIfError (err)
    End If
    'MsgBox "测试完成"
    MsgBox "TestOk"
    End Sub
    Sub QuitIfError(errID)
    On Error GoTo DoErr
    MsgBox "errID:" & CLng(errID)
    '   If lib.ErrorIndicatesFailure(err) Then
    '      WScript.Echo ("Error: " & lib.GetErrorText(err, Empty))
    '      WScript.Quit
    '   End If
    Exit Sub
    MsgBox err.Description
    End Sub

  2. #2
    Junior Member
    Join Date
    Nov 2017
    South Australia ( SA )

    Re: Vmware Sdk For vb6(VixCOM64.dll),vbs-CreateObject("VixCOM.VixLib")

    G'Day Xiaoyao

    Quote Originally Posted by xiaoyao View Post
    Need VMWare VIX Automation Tools and SDK
    From what I have read VIX has been deprecated, don't you just hate that word

    Page 74 says

    "It has been deprecated for vSphere. "

    I really interested in reading .vmx files looking for a data structure eg. annotation = " ...

    Anyone know what has replaced VIX ?


  3. #3
    New Member BlacksAbs's Avatar
    Join Date
    Apr 2021

    Re: Vmware Sdk For vb6(VixCOM64.dll),vbs-CreateObject("VixCOM.VixLib")

    What is deprecated? *** do they mean by that? VMware is a cool program that helps with a lot of things, but it has its problems. Finding information about it is not easy. I had no idea how to use vm ware compatibility tools. It was a nightmare until I found the Altaro website. They have tutorials for anything connected to VMware.
    It's crazy, patching is hard, using tools is hard, you have to do everything perfectly for it to make it work. They have added some cool things like a quick boot that lets you update everything faster, but they should do more stuff like that to make it easier for us.
    Last edited by BlacksAbs; Apr 22nd, 2021 at 08:53 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Click Here to Expand Forum to Full Width