Setting the UUID of a VirtualBox VDI
I wrote this script over a year ago because I needed a way to set the UUID of a VirtualBox hard disk (VDI) to a specific value. It will allow you to set the UUID in the headers of a VDI to a specific value.
To use this script:
./set-uuid.py {6918cef1-d9c4-4420-b0ef-01920c992a25} path/to/virtual-disk.vdi
The dashes and brackets are not required.
The script is available on my GitHub site: https://github.com/jordoncm/misc/blob/master/set-uuid.py
We had been distributing a VDI as the only file on a second physical hard drive on a dual hard drive Windows system and we wanted to be able to upgrade systems by simply removing the second hard drive with the VDI on it and putting in a new one. However the UUID of the new VDI we created did not match the UUID of the virtual hard disk record in the XML configuration of the virtual machine. So I read up on the binary header block of a VirtualBox VDI and wrote a Python script that will allow you to change the UUID to whatever you want.
It seems that VirtualBox may now have some internal commands to do this now as well, although I am not sure they are released or officially supported.
http://forums.virtualbox.org/viewtopic.php?f=6&t=4821&start=15

