HRESULT GetRootSnapshot([in] LONG index, [out] ISnapshot** snapshot, [out,retval] ULONGLONG* error);
This function returns the handle of the specified snapshot belonging to the virtual machine referenced by the IVM object against which this method is invoked.
Dim lib Dim host Dim vm Dim job Dim err Dim results results = Nothing Set lib = CreateObject("VixCOM.VixLib") 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), result) If lib.ErrorIndicatesFailure(err) Then ' Handle 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), result) If lib.ErrorIndicatesFailure(err) Then ' Handle error... End If Set vm = results(0) Dim numSnapshots err = vm.GetNumRootSnapshots(numSnapshots) If lib.ErrorIndicatesFailure(err) Then ' Handle error... End If Dim snapshot For i=0 to numSnapshots-1 err = vm.GetRootSnapshot(i, snapshot) If lib.ErrorIndicatesFailure(err) Then ' Handle error... End If ' ...Access snapshot properties... Next