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
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
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
That works. Thanks!