To enable the "Schedule VM Compatibility Upgrade..." tick box for a virtual machine called VM1 you can use the next PowerCLI script:
$spec = New-Object VMware.Vim.VirtualMachineConfigSpec
$spec.ScheduledHardwareUpgradeInfo = New-Object VMware.Vim.ScheduledHardwareUpgradeInfo
$spec.ScheduledHardwareUpgradeInfo.scheduledHardwareUpgradeStatus = 'pending'
$spec.ScheduledHardwareUpgradeInfo.upgradePolicy = 'onSoftPowerOff'
$spec.ScheduledHardwareUpgradeInfo.versionKey = 'vmx-09'
Get-VM -Name VM1 | ForEach-Object {
$_.ExtensionData.ReconfigVM_Task($spec)
}
The script sets the compatibility to "ESX 5.1 and later" and enables the "Only upgrade after normal guest OS shutdown" tick box.
Discussion moved from VMware ESXi™ 4 to VMware vSphere™ PowerCLI
To enable the "Schedule VM Compatibility Upgrade..." tick box for a virtual machine called VM1 you can use the next PowerCLI script:
$spec = New-Object VMware.Vim.VirtualMachineConfigSpec
$spec.ScheduledHardwareUpgradeInfo = New-Object VMware.Vim.ScheduledHardwareUpgradeInfo
$spec.ScheduledHardwareUpgradeInfo.scheduledHardwareUpgradeStatus = 'pending'
$spec.ScheduledHardwareUpgradeInfo.upgradePolicy = 'onSoftPowerOff'
$spec.ScheduledHardwareUpgradeInfo.versionKey = 'vmx-09'
Get-VM -Name VM1 | ForEach-Object {
$_.ExtensionData.ReconfigVM_Task($spec)
}
The script sets the compatibility to "ESX 5.1 and later" and enables the "Only upgrade after normal guest OS shutdown" tick box.
Excellent thanks, will try this shortly
Cool, I just posted a thread http://communities.vmware.com/message/2249221#2249221 where I wrapped this in a quick ps script that you can point to vcenter and optional cluster and it will set it for all powered on vms.
Still struggling to get this working it looks like it cant add in the "scheduledhardwareupgrade" tasks??:smileyangry:
Which PowerCLI version are you using? Do a: Get-PowerCLIVersion
The latest version at this moment is "VMware vSphere PowerCLI 5.1 Release 2 build 1012425". If you don't have this version, try to download and install it and run the script again.
Yes make sure you have the latest PowerCLI.
Thanks for your help works a treat!:smileylaugh: