- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Discussion moved from VMware ESXi™ 4 to VMware vSphere™ PowerCLI
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Excellent thanks, will try this shortly ![]()
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Still struggling to get this working it looks like it cant add in the "scheduledhardwareupgrade" tasks??:smileyangry:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes make sure you have the latest PowerCLI.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for your help works a treat!
:smileylaugh: