Name

GetRootSnapshot

Description

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.

Parameters

vmHandle
Identifies a virtual machine. Call VixVM_Open() to create a virtual machine handle.
index
Identifies a root snapshot. See below for range of values.
snapshotHandle
Returns an ISnapshot object the represents the root snapshot.

Return Value

HRESULT]

Remarks

Side Effects

None.

Requirements

VixCOM.h, since VMware Workstation 6.0

Example

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

Set snapshot = Nothing
Set results = Nothing
Set job = Nothing
Set vm = Nothing

host.Disconnect()

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