VMware Cloud Community
DSeaman
Enthusiast
Enthusiast
Jump to solution

Script to change VMX BIOS.UUID value?

Due to how we upload VM templates to standalone ESXi 4.1 hosts prior to them being joined to vCenter, the UUIDs for the templates come out the same. We use Veeam Backup to restore the templates, so they can be compressed enough to fit on a DVD.

I'm looking for a short PowerShell script that can set a custom BIOS.UUID value for a named VM on ESXi 4.1. In KB 1002403 VMware has a pearl script that lets you do this, but we are a PowerShell shop and thus would be easier for us to customize in the future. Ideally the script would generate a pseudo-random UUID without user input. For example, set the last six digits to use the current Month, day, and minute (MMDDMM, e.g. 100111).

vCenter will of course create unique UUIDs for our production VMs, so this is just to manage the initial templates we upload to standalone servers at the "factory".

Ideas?

Derek Seaman
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

Try something like this

$vmName = <vmname>
$newUuid = <new-uuid>

$spec = New-Object VMware.Vim.VirtualMachineConfigSpec
$spec.uuid = $newUuid
$vm = Get-VM -Name $vmName
$vm.Extensiondata.ReconfigVM_Task($spec)

Note that this the call to the method in it's simplest form, no waiting for task completion, no error checking.

____________

Blog: LucD notes

Twitter: lucd22


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

0 Kudos
4 Replies
LucD
Leadership
Leadership
Jump to solution

Try something like this

$vmName = <vmname>
$newUuid = <new-uuid>

$spec = New-Object VMware.Vim.VirtualMachineConfigSpec
$spec.uuid = $newUuid
$vm = Get-VM -Name $vmName
$vm.Extensiondata.ReconfigVM_Task($spec)

Note that this the call to the method in it's simplest form, no waiting for task completion, no error checking.

____________

Blog: LucD notes

Twitter: lucd22


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
DSeaman
Enthusiast
Enthusiast
Jump to solution

Thanks..I wrapped it up in a loop to go through a hosts's VM, and added a random pseudo-random GUI generator.

Derek Seaman
0 Kudos
LucD
Leadership
Leadership
Jump to solution

Great, perhaps you can add it to this thread ?

Could be useful for others.

____________

Blog: LucD notes

Twitter: lucd22


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
DSeaman
Enthusiast
Enthusiast
Jump to solution

So I wrote a blog about my UUID problem, and posted the script that automatically creates unique UUIDs for all VMs on a ESX host. You can check out my blog post at:

http://derek858.blogspot.com/2010/10/making-your-vmware-vm-uuids-unique.html

Derek Seaman
0 Kudos