How to revert a virtual machine with vix for multiple snapshots with same name?
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.
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
Answers (1)
Please log in to answer
Posted by:
Pressanykey
8 years ago
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
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
Comments:
-
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. - ur00361883 8 years ago-
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 - Pressanykey 8 years ago-
Is there anyway to identify them with some id..Instead of date created.? - ur00361883 8 years ago
-
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... - Pressanykey 8 years ago