Change VMDK UUID using PowerCLI

By | June 23, 2015

One problem with using the Netapp VSC for backup and restore was that the VSC could only restore from backups that it knew that it took. This was also an advantage for Veeam, Veeam could do a restore (via flexcloning the volume) of any Netapp snapshot. Unfortunately I wasn’t able to pursue Veeam any further, but my storage admin had another idea.

He was able use some scripting (my guess is Netapp Powershell cmdlets) to do a SnapRestore(?) of the VMDKs. In some ways this was better than VSC or Veeam because you didn’t have to deal with mounting a FlexClone. There was extra management that needed to occur because of the possibility of the restores lingering on datastores, but it was a pretty good solution overall.

One problem that I ran into was that if you attach the VMDK to the original VM, you would get errors because the VMDK had the same UUID as the original. You actually get a popup warning similar to the “did you move or copy this VM” but with the option to either continue mounting or cancel. If you continue the VM can freeze up because it doesn’t know which disk is which.

I did some research and found that there IS a way to do this via PowerCLI, but you need to create your own UUID (also known as ddb.uuid)

From LucD I got the syntax for the Virtual Disk Manager:

From this blog I was able to determine that I could take the first half of the UUID of the VMDK and create my own. Unfortunately I couldn’t use his code as is because it was written in Java (against the vSphere API). The only code that I really needed was the portion to create the second half of the UUID, so I found a cmdlet that can create a Windows GUID and hacked the GUID up to make the back portion of my UUID.


4 thoughts on “Change VMDK UUID using PowerCLI

  1. Colin

    This is an amazing script and I thank you for sharing it with us. You have saved me hours of work attempting to get this done. All I can say is Thank You!

    1. Chris Post author

      Thanks for the comment! Hearing that I saved you time makes it all worth it.

  2. Pingback: Semi-Famous Code | Virtual Chris

  3. Pingback: PowerShell GUI VMware and FlashArray Storage Management Tool | Cody Hosterman

Leave a Reply

Your email address will not be published. Required fields are marked *