PowerCLI

  • 1.  Regenerating UUID.BIOS

    Posted Jan 28, 2025 10:10 AM

    I'm cloning the storage snapshot to a new datastore to be able to register all cloned VMs to the VMware vCenter. The cloned virtual machines will have their networks disconnected, and all VMs will be registered with new names. However, the issue I am facing is that for some VMs, I need to modify the 'UUID.BIOS' ID in the VMX file before registering the virtual machines since it will not be updated during the registration process.

    Using PowerShell, I can connect with vCenter and download/upload VMX files from the datastore to remove the UUID.BIOS line from the VMX files to force vCnter to regenerate it. The issue with this approach is that it is very slow.

    So far, I found that SSH can be used to execute the command, but it requires a connection to each ESXi host with access to the datastore.

    Is there an option to force vCenter to regenerate the 'UUID.BIOS' during virtual machine inventory registration, or is there a way to connect with vCenter and send the command directly to the ESXi host via PowerShell without using an SSH client?

    Thank you in advance for any suggestions.



  • 2.  RE: Regenerating UUID.BIOS

    Posted Jan 28, 2025 01:44 PM

    Do you actually need the vCenter to generate a GUID?
    In fact you can change the GUID yourself

    Something like this for example

    $vmName = 'MyVM'
    
    $vm = Get-VM -Name $vmName
    $vm.ExtensionData.Config.Uuid
    
    $spec = New-Object VMware.Vim.VirtualMachineConfigSpec
    $spec.uuid = New-Guid | Select -ExpandProperty Guid
    $vm.Extensiondata.ReconfigVM_Task($spec)
    
    $vm = Get-VM -Name $vmName
    $vm.ExtensionData.Config.Uuid
    


    ------------------------------


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


    ------------------------------



  • 3.  RE: Regenerating UUID.BIOS

    Posted Jan 29, 2025 05:57 AM

    The issue with UUID.BIOS is related to systems like Citrix or CommVault that depend on it. Since the UUID.BIOS remains unchanged during the VM registration process, this could impact those systems during registration of a cloned VM.

    To ensure resilience in an unknown environment, I am searching for a solution that can be executed before registering a cloned VM.

    Downloading/uploading is a very slow solution when dealing with many VMs, so using a parallel process might help speed it up.

    If anyone know whether there's an option in PowerShell or the REST API to execute a command similar to "find /StorageVolume -type f -name "*.vmx" -exec sed -i "/^uuid.bios/d" {} +" within ESXi, since this will be easiest and fastest way.




  • 4.  RE: Regenerating UUID.BIOS

    Posted Jan 29, 2025 09:25 AM

    So setting a new GUID is not a valid solution?



    ------------------------------


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


    ------------------------------



  • 5.  RE: Regenerating UUID.BIOS

    Posted Jan 29, 2025 10:01 AM

    The solution you suggested is technically good, but it introduced a brief potential window where Citrix might detect a second registered VM with the same UUID.

    I just want to prevent this possibility before the registration process is triggered, but in a faster way than the download/upload VMX method, if possible.