VMware Cloud Community
lmhealthcare
Contributor
Contributor
Jump to solution

Update disk.EnableUUID, script not working

Below I've posted a script I was hoping to use to add the disk.EnableUUID option to all my VMs. This is important to ebale application quiescing on vms made before 4.1. It isn't actually working. Anybody want to take a stab at figurig out why?

$vCenter = Read-Host "Enter vCenter Server name"

Connect-VIServer $vCenter

$vmConfigSpec = New-Object VMware.Vim.VirtualMachineConfigSpec

$extra = New-Object Vmware.Vim.OptionValue

$extra.Key = "disk.EnableUUID"

$extra.Value = $true

$vmConfigSpec.extraconfig = $extra

Get-VM | % { (Get-View $_.ID).ReconfigVM($vmConfigSpec)}

Disconnect-VIServer -Confirm:$false

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

The problem is caused by the fact that the Value property needs a string which says "true" and not the PS Boolean value $true.

If you change the script like this, it should work.

$vCenter = Read-Host "Enter vCenter Server name"

Connect-VIServer $vCenter

$vmConfigSpec = New-Object VMware.Vim.VirtualMachineConfigSpec
$extra = New-Object Vmware.Vim.OptionValue 
$extra.Key = "disk.EnableUUID"
$extra.Value = "true"
$vmConfigSpec.extraconfig = $extra

Get-VM | % { (Get-View $_.ID).ReconfigVM($vmConfigSpec)}

Disconnect-VIServer -Confirm:$false

____________

Blog: LucD notes

Twitter: lucd22


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

View solution in original post

0 Kudos
2 Replies
LucD
Leadership
Leadership
Jump to solution

The problem is caused by the fact that the Value property needs a string which says "true" and not the PS Boolean value $true.

If you change the script like this, it should work.

$vCenter = Read-Host "Enter vCenter Server name"

Connect-VIServer $vCenter

$vmConfigSpec = New-Object VMware.Vim.VirtualMachineConfigSpec
$extra = New-Object Vmware.Vim.OptionValue 
$extra.Key = "disk.EnableUUID"
$extra.Value = "true"
$vmConfigSpec.extraconfig = $extra

Get-VM | % { (Get-View $_.ID).ReconfigVM($vmConfigSpec)}

Disconnect-VIServer -Confirm:$false

____________

Blog: LucD notes

Twitter: lucd22


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

0 Kudos
lmhealthcare
Contributor
Contributor
Jump to solution

That works. Thanks!

0 Kudos