HRESULT UpgradeVirtualHardware([in] LONG options, [in] ICallback* jobDoneCallback, [out,retval] IJob** upgradeJob);
Upgrades the virtual hardware version of the virtual machine to match the version of the VIX library. This has no effect if the virtual machine is already at the same version or at a newer version than the VIX library.
VBScript:
Dim lib Dim job Dim err Dim results Dim host Dim vm Set lib = CreateObject("VixCOM.VixLib") Set results = Nothing Set job = lib.Connect(VixCOM.Constants.VIX_API_VERSION, VixCOM.Constants.VIX_SERVICEPROVIDER_VMWARE_WORKSTATION, Empty, 0, Empty, Empty, 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) Set job = host.OpenVM("c:\Virtual Machines\vm1\win2000.vmx", Nothing) err = job.Wait(Array(VixCOM.Constants.VIX_PROPERTY_JOB_RESULT_HANDLE), results) If lib.ErrorIndicatesFailure(err) Then ' Handle the error... End If Set vm = results(0) Set job = vm.UpgradeVirtualHardware(0, Nothing) err = job.WaitWithoutResults() If lib.ErrorIndicatesFailure(err) Then ' Handle the error... End If host.Disconnect()