Quantcast
Channel: VMware Communities : All Content - All Communities
Viewing all articles
Browse latest Browse all 175326

Replace Bios.UUID after clone (copy uuid to clone)

$
0
0

Good evening,

we do run a test lab with some bigip appliances. As we play around with them and usually mess them up i wanted to create a clone to have a full backup of a clean appliance.

i figured out when i copy the bios.uuid i will not loose the activated license and so i do not need to bother the vendor again and again.

 

I am stuck in my scheduled task with the replacement. The tasks run shutdown the vm and take the clone.

I have to run these actions in jobs don't ask me why. I could figure out why the "pure" commands do not work.

 

So here is the piece where i am stuck... And i would love if someone could enlighten me to get this to run.

I tagged the machines so the bios.uuid will not get replaced on other machines. Having the vendor details of the vm would be much cooler and i might open another post about this.

 

So i get the uuid from the master vm

# Get BIOS UUID

$uuid = Get-VM $vmname | %{(Get-View $_.Id).config.uuid}

And geht the Tag of the vm

# Get Tag of Virtual Machine (if assigned)

$tag = Get-VM $vmname | Get-TagAssignment | select Tag

 

$vmname is the master

$firstbackupname is the name of the clone

 

And here is the code which should replace the uuid on the vm ($firstbackupname)

 

if ($tag -match "F5") {

                       LogWrite ""

                       LogWrite "Task Backup - F5 Tag assigned. Changing UUID"

                       Start-Job -ScriptBlock {

                                                $spec = New-Object VMware.Vim.VirtualMachineConfigSpec

                                                $spec.uuid = $uuid

                                                $firstbackupname.Extensiondata.ReconfigVM_Task($spec)

                                               }

                       Get-Job | Wait-Job

                       LogWrite "-OK-----------------> Changed UUID to $uuid"

                      }

 

The scenario does shutdon the vm, wait for shutdown then take a clone and now it should copy the master uuid to the clone. Right after the vm gets a power on.

 

I would be very happy if you coudl help me out here.

thank you very much for any tip and help.

 

best wishes armin


Viewing all articles
Browse latest Browse all 175326

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>