VMware Cloud Community
athurston
Enthusiast
Enthusiast
Jump to solution

Harware Compatability upgrade

Hi All,

does anyone know how i can set this tick box in the picture below with a powershell / powercli script? I do not need it to update there and then just so when the machine next gets restarted it upgrades the hardware level.

Thanks

Alex

1 Solution

Accepted Solutions
RvdNieuwendijk
Leadership
Leadership
Jump to solution

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.


Blog: https://rvdnieuwendijk.com/ | Twitter: @rvdnieuwendijk | Author of: https://www.packtpub.com/virtualization-and-cloud/learning-powercli-second-edition

View solution in original post

8 Replies
a_p_
Leadership
Leadership
Jump to solution

0 Kudos
RvdNieuwendijk
Leadership
Leadership
Jump to solution

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.


Blog: https://rvdnieuwendijk.com/ | Twitter: @rvdnieuwendijk | Author of: https://www.packtpub.com/virtualization-and-cloud/learning-powercli-second-edition
athurston
Enthusiast
Enthusiast
Jump to solution

Excellent thanks, will try this shortly Smiley Happy

0 Kudos
kluken
Contributor
Contributor
Jump to solution

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.

athurston
Enthusiast
Enthusiast
Jump to solution

Still struggling to get this working it looks like it cant add in the "scheduledhardwareupgrade" tasks??:smileyangry:

0 Kudos
RvdNieuwendijk
Leadership
Leadership
Jump to solution

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.

Blog: https://rvdnieuwendijk.com/ | Twitter: @rvdnieuwendijk | Author of: https://www.packtpub.com/virtualization-and-cloud/learning-powercli-second-edition
kluken
Contributor
Contributor
Jump to solution

Yes make sure you have the latest PowerCLI.

0 Kudos
athurston
Enthusiast
Enthusiast
Jump to solution

Thanks for your help works a treat!Smiley Happy:smileylaugh:

0 Kudos