vmhyperv
Contributor
Contributor

VMware Hardware version upgrading for multiple VMs

Hi,

Recently i upgraded ESX3.5 to ESXi4.1 and i have around 250 vms in different cluster. Is it possible to upgrade Harware version to 7 from  4 for  multiple VMs from Power Cli scripting tools. Any help in this will be greatly appreciated.

Thanks

VMguys

0 Kudos
7 Replies
LucD
Leadership
Leadership

Did you try the Set-VM cmdlet with the Version parameter ?


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

vmhyperv
Contributor
Contributor

Hi LucD,

    Thanks for your prompt response.Can you please elaborate little bit with example. As of now i havnt tried as i was not aware  of  cmlets for VMware Hwareware upgrade.Suppose i am having 100 VMs.e.g vm1,vm2 ...etc.

I want to automate this through script for current upgrade project from ESX3.5 to ESXi4.1 Thanks !!

0 Kudos
LucD
Leadership
Leadership

Similarly to the other thread, you could do

Get-VM -Name (1..100 | %{"VM$_}) | Set-VM -Version v7 -Confirm:$false

Note that the VM needs to be powered off to do the hardware upgrade.

You could combine this

Get-VM -Name (1..100 | %{"VM$_}) |  Stop-VM -Confirm:$false | Set-VM -Version v7 -Confirm:$false | Start-VM -Confirm:$false

But this will not shutdown the guest OS gracefully. It's a hard power off of the VM


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

vmhyperv
Contributor
Contributor

LucD,

  Apologise for the  confusion.As we have 15 cluster in the environment with 3 ESX host in each cluster and i want to upgrade the Hardware version of a particular Cluster say Cluster2 where i have 20  vms where ESX recently migrated from ESX3.5 to ESXi4.1 Then what would be the change in script cluster wise because we are upgrading clusterwise from ESX3.5 to ESX4.1 Because this might upgrade the entire vm (1..100) in the datacenter where we dont have down time for entire vms. Please help on this

Thanks

vmguys

0 Kudos
LucD
Leadership
Leadership

It would just be the selection of the VMs that needs to be changed.

Like this

Get-Cluster -Name Cluster2 | Get-VM |
Stop-VM -Confirm:$false | Set-VM -Version v7 -Confirm:$false | 
Start-VM -Confirm:$false


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

0 Kudos
vmhyperv
Contributor
Contributor

Thanks LucD,

   Will let you know.So this commands for upgrade appllies for single VMs rather than multipls vms right ?

thanks

vmguys

0 Kudos
LucD
Leadership
Leadership

If you look at the VM parameter of the Set-VM cmdlet, you'll see that it accepts an array of VM objects.

So you can pass one or more VM objects to the cmdlet.

In the example above I used the pipeline to pass each individual VM object to the Set-VM cmdlet.

You could also first collect all the VM objects in an array, and then pass this array to the cmdlet.

Something like this

$vms = Get-Cluster -Name Cluster2 | Get-VM

Stop-VM
-VM $vms -Confirm:$false
Set-VM
-VM $vms -Version v7 -Confirm:$false
Start-VM -VM $vms -Confirm:$false

But this is not using one of the strengths of PowerShell, the pipeline.


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

0 Kudos