Hi there
My use case is as follows :
I have a set of VM's on which I have some snapshots, these snapshots are meant for lab purpose for students to rollback and move forward.
Now I want to create multiple such set of VM's, for which I thought let me clone, but the moment I clone all the snapshots on the new VM's are gone and disks are consolidated. So is there any way to retain the Snapshots on the new VM while copying/cloning.
Any pointers on the above will be much appreciated. Thanks
Regards,
Born2Learn
> Can you please highlight the files which you edited for the MAC address and UUID stuff.
That is not necessary at all if you follow Sandeeps list:
1. Power of the VM
2. Copy the entire VM folder to your new host
3. Browse to the datastore from vCenter or host client and locate the .vmx file
4. Right click and say, "Add to Inventory".
5. Provide a name for VM and add to inventory.
6. Power on VM.
7. When the client asks you how you moved the files, select the option "Copied it"
Answering "I copied it" should do it.
But you need to doublecheck all the vmdk-descriptors and make sure that none of them uses an absolut path.
Your snapshots and your basedisk need to be in a single folder.
I altered
ethernet0.generatedAddress
uuid.bios
vc.uuid
BTW, I'm not saying changing these is required, but these are unique identifiers which I know should be different regardless what mechanism makes that so.
ok thanks daphnissov
LucD : Can you please help me in editing the value of
ethernet0.generatedAddress
uuid.bios
vc.uuid
in various text files in a VM folder like vmx, vmdk and vmsn programattically. I tried to do the following but couldn't get it through.
$vm = get-vm "testvm"
$snaps = Get-Snapshot -VM $vm
$date = get-date -format “dd hh mm ss”
$newUuid = “56 4d 50 2e 9e df e5 e4-a7 f4 21 3b ” + $date
$spec = New-Object VMware.Vim.VirtualMachineConfigSpec
$spec.uuid = $newUuid
$vm.Extensiondata.ReconfigVM_Task($spec)
foreach($snap in $snaps)
{
#(get-view $snap.Id).Config.uuid
((get-view $snap.Id).Config.uuid).ReconfigVM_Task($spec)
}
Regards,
born2learnn
LucD : Can you please advise.
For a VM you can change/reset the MACAddress, InstanceUUid and the Uuid through the ReconfigVM method.
But afaik there is no documented method to do this for a Snapshot of a VM.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
ok.. thanks LucD
Can you please advise if this can be achieved by any other way. I am now trying to write a script which I will run inside the ESXi and will edit all the *.vmsn files, but appreciate if you could think of something better.
Sorry, but as I already mentioned, I don't know of any supported method to do this.
Besides opening the files in a text editor and hoping for the best, I know of no other method.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
okay ..no problem LucD.
Thanks for your help daphnissov
Hi, have you solved this in any way? I have same use case.