With the below command I am able to revert a virtual machine in vmware workstation to a snapshot mentioned.

$sVMPath = <path of the vmx file of virtual machine>

$sSnapshot = <snapshot name>

$Ret = RunWait(@ComSpec & " /c VMRun.exe -T WS revertToSnapshot ""$sVMPath$"" ""$sSnapshot$"" nogui", "", @SW_HIDE)

But the problem here is the virtual machine may contain multiple snapshots with same name because multiple users use same workstation and eventually they are keeping same name sometimes like below or in attachment.

Both snapshots are with same name and in GUI we can use them with no issue.

Capture1.JPG

 

But with autoit or with vmrun command line it is showing error as 

Error: The name does not uniquely identify one snapshot

Could anyone please help me on this.

0 Comments   [ + ] Show Comments

Comments

Please log in to comment

Answers

0
Hi,
the content of the error says it all. Don't use the same name for snapshots ;-)
Have you tried using the COM interfaces via AutoIT? Perhaps they allow you to use the internal identifier instead of the plain name for snapshots.

Phil
Answered 05/17/2016 by: Pressanykey
Red Belt

  • Hi Phil,

    Thanks for the inputs.
    Yeah, the content of the error is self descriptive. But when we think of GUI mode, they are distinguished as different snapshots even the names are same.So in the background some other primary key is taken to separate snapshots.

    I am getting the same error with COM interface provided by VIX API.

    Please suggest if any other options we can try on this.
    • Hi,
      having a quick look at the API, if you know in which order the snapshot was created, you could theoretically assume that the "newest" snapshot has a lower index, and therefore if two snapshots have the same name, the one with the lowest ID would be the one that you do / do not want to delete...
      https://www.vmware.com/support/developer/vix-api/vix115_reference/index2.html
      (VixVM_GetRootSnapshot)

      Phil
      • Is there anyway to identify them with some id..Instead of date created.?
      • Hi,
        as I mentioned in my previous post, try to see if my theory regarding the indexing is correct. Other than that you'll just have to bit the bullet and delete all of your snapshots, and ensure that when you create them that you use unique names...
Please log in to comment
Answer this question or Comment on this question for clarity
Admin Script Editor
Admin Script Editor is an integrated scripting environment available free here at ITNinja

Share