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

Reply
0 Kudos