VMware Cloud Community
srajsenthil
Contributor
Contributor

Upgrade VM os

Hello, there is a VM created from template based on say RHEL 5.0. Now the VM needs to be upgraded with RHEL 6.0 using another template.

Is it possible to ugrade using PowerCLI or vijava? Please let me know.

Regards,

Senthil

0 Kudos
2 Replies
LucD
Leadership
Leadership

You could do something like this.
But note that the new VM that is created might need to be powered on to complete the customization process.

Depends how your templates are set up.

Also note that the new template is created on the same ESXi node where the old template is located, you might need to change that.

$templateV1 = 'rhel5'

$templateV2 = 'rhel6'

$esxName = (Get-View -Id (Get-Template Test1).hostid).Name

Get-Template -Name $templateV1 | Set-Template -Name "$($templateV1)-backup"

New-VM -Name $templateV1 -Template $templateV2 -VMHost $esxName |

Set-VM -ToTemplate -Confirm:$false


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

0 Kudos
srajsenthil
Contributor
Contributor

Thanks LucD. Your response is appreciated. I will try this and update here.

0 Kudos