1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| (Get-WmiObject -Namespace root\virtualization\v2 -Class Msvm_VirtualSystemSettingData -Filter "ElementName='devops01'").BIOSGUID
$VMname="devops01" $vmx = Get-WmiObject -Namespace root\virtualization\v2 -Class msvm_virtualsystemsettingdata
$CurrentSettingsData = $vmx | Where-Object { $_.ElementName -eq $VMname }
$CurrentSettingsData.BIOSGUID
$GUID = [System.Guid]::NewGuid()
$CurrentSettingsData.BIOSGUID = "{" + $GUID.Guid.ToUpper() + "}"
$VMMS = Get-WmiObject -Namespace root\virtualization\v2 -Class msvm_virtualsystemmanagementservice $ModifySystemSettingsParams = $VMMS.GetMethodParameters('ModifySystemSettings')
$ModifySystemSettingsParams.SystemSettings = $CurrentSettingsData.GetText([System.Management.TextFormat]::CimDtd20)
$VMMS.InvokeMethod('ModifySystemSettings', $ModifySystemSettingsParams, $null)
|