Change a Hyper-V VM BIOS GUID or UUID

Last Modified: Fri, 16 May 2025 15:56:09 +0000 ; Created: Sat, 18 Nov 2023 19:09:12 +0000

I had to search a number of powershell and other methods for editing a Hyper-V BIOS GUID / UUID when using the Windows 11 Pro Hyper-V software. The few examples I found did not work with the newer Hyper-V APIs.

Credits

Modified code to change the Hyper-V BIOSGUID

I updated this with a simpler example from nuvotex.de
# Modified 2025-05-16

# HANDY
#	set-executionpolicy remotesigned -Scope Process


$VMName = 'YOURNAMEHERE'
$MSVM = gwmi -Namespace root\virtualization\v2 -Class msvm_computersystem -Filter "ElementName = '$VMName'"
 
# get current settings object
$MSVMSystemSettings = $null
foreach($SettingsObject in $MSVM.GetRelated('msvm_virtualsystemsettingdata'))
{
    $MSVMSystemSettings = [System.Management.ManagementObject]$SettingsObject
}

$MSVMSystemSettings
 
# assign a new id
$MSVMSystemSettings['BIOSGUID'] = "{$([System.Guid]::Parse('Z00FD000-9DA0-0Z0A-000A-Z1234567Z321'))}"
#$MSVMSystemSettings['BIOSGUID'] = "{$(([System.Guid]::NewGuid()).Guid.ToUpper())}"

# update a few others
$MSVMSystemSettings['BaseBoardSerialNumber'] = "1234-5678-9012-3456-7890-1234-56"
$MSVMSystemSettings['BIOSSerialNumber'] = "1234-5678-9012-3456-7890-1234-56"
$MSVMSystemSettings['ChassisAssetTag'] = "1234-5678-9012-3456-7890-1234-56"
$MSVMSystemSettings['ChassisSerialNumber'] = "1234-5678-9012-3456-7890-1234-56"

$VMMS = gwmi -Namespace root\virtualization\v2 -Class msvm_virtualsystemmanagementservice
# prepare and assign parameters
$ModifySystemSettingsParameters = $VMMS.GetMethodParameters('ModifySystemSettings')
$ModifySystemSettingsParameters['SystemSettings'] = $MSVMSystemSettings.GetText([System.Management.TextFormat]::CimDtd20)
# invoke modification
$VMMS.InvokeMethod('ModifySystemSettings', $ModifySystemSettingsParameters, $null)

Convert VMware UUID To Windows Guest

Param (
    [Parameter(Mandatory=$True)]
    [String]
    $rawUUID
)

# Create an array of each half (hyphen delimiter)
$octets = $rawUUID.Split("-")

# Create an array of each two-character byte (space delimiter)
$bytes = $octets[0].Split(" ") + $octets[1].Split(" ")

# Build the final string, piecing together byte by byte
$prettyUUID = $bytes[3] + $bytes[2] + $bytes[1] + $bytes[0] + "-" + $bytes[5] + $bytes[4] + "-" + $bytes[7] + $bytes[6] + "-" + $bytes[8] + $bytes[9] + "-" + $bytes[10] + $bytes[11] + $bytes[12] + $bytes[13] + $bytes[14] + $bytes[15]

Return $prettyUUID