Quantcast
Channel: VMware Communities : Popular Discussions - VIX API
Viewing all articles
Browse latest Browse all 34639

How to start a specific named snapshot

$
0
0

I looked through the documentation and have tried to search (to no avail) on how to load a specific named snapshot.  I'm copied my code (VB6) below, any direction below would be greatly appreciated...assume any variables you don't see are Dim'ed outside of method.

 

Please tell me I was close, but just misunderstood how this should work...this one seemed like it should be better documented.

 

Thanks in advance for your help on this!

Dan Barnes

 

Private Sub OpenVM(vmname As String)

 

Dim handle

 

' Open the virtual machine with the given .vmx file.

    Set job = host.OpenVM(vmname, Nothing)

    err = job.Wait(Array(VixCOM.Constants.VIX_PROPERTY_JOB_RESULT_HANDLE), results)

    If lib.ErrorIndicatesFailure(err) Then

       If err.Number = 4000 Then MsgBox "couldn't find VM file to load"

       Exit Sub

    End If

     

    Set vm = results(0)

     

    'get a named snapshot based on the value in textbox

    err = vm.GetNamedSnapshot(txtSnapshot.Text, handle)

    If lib.ErrorIndicatesFailure(err) Then

       MsgBox "Unable to get snapshot"

    Else

 

    End If

     

     

    ' Power on the virtual machine we just opened. This will launch Workstation if it hasn't

    ' already been started.

    Set job = vm.PowerOn(VixCOM.Constants.VIX_VMPOWEROP_LAUNCH_GUI, Nothing, Nothing)

    ' WaitWithoutResults is just like Wait, except it does not get any properties.

    err = job.WaitWithoutResults()

    If lib.ErrorIndicatesFailure(err) Then

       MsgBox "Error on OpeningVM - Err:" + err.Number

    End If

         

End Sub


Viewing all articles
Browse latest Browse all 34639

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>