VMware Cloud Community
tdubb123
Expert
Expert

powercli upgrade vm compatibility

any idea how to upgrade or schedule a VM compatibility upgrade?

I am running the VM on esxi 5.5 so need to go to v10

4 Replies
LucD
Leadership
Leadership

You could do something like this

foreach($vm in (Get-VM | where{$_.Version -ne 'v10')){

    $spec = New-Object -TypeName VMware.Vim.VirtualMachineConfigSpec

    $spec.ScheduledHardwareUpgradeInfo = New-Object -TypeName VMware.Vim.ScheduledHardwareUpgradeInfo

    $spec.ScheduledHardwareUpgradeInfo.UpgradePolicy = [VMware.Vim.ScheduledHardwareUpgradeInfoHardwareUpgradePolicy]::always

    $spec.ScheduledHardwareUpgradeInfo.VersionKey = “vmx-10”

    $vm.ExtensionData.ReconfigVM_Task($spec)

}


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

Reply
0 Kudos
tdubb123
Expert
Expert

Thanks Luc

Any idea why I am getting this error here?

Screen Shot 2018-07-13 at 10.57.57 PM.png

Reply
0 Kudos
LucD
Leadership
Leadership

Leave out the Format-Table (ft), just before the Out-GridView.


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

Reply
0 Kudos
DASmokeDog
Contributor
Contributor

You would think the OP being a Master level would mark this as answered. Anyway great answer LucD as always.