Hi all, have a question on using powercli towards vSpahre 6.5 vapps.
I have a MAster vApp with multiple VMs.
I am able to create a new vApp and create linked clones of VM's in the MAster App.
Now I want to set the boot priority an the new vApp the same as on the MAster vApp.
Anny suggestions on how to do this?
Already found out that I can read the vApp startup options via
$vapp = Get-VApp "MASTER_vApp"
$MastervApp= $vapp.ExtensionData.VAppConfig.EntityConfig
But I am not sure how to set these on the new vApp. the name of a VM in the new vApp has a reference to the Master VM
any help welcome
Gert
You can do something like this, but it assumes you have the same number of VMs in the Master as in the New vApp. There is no error checking!
This copies all settings, except the Key, from the master to the new vApp.
You can also copy only specific values, but that would require a change in the loop.
$mastervapp = Get-VApp -Name Master
$newvapp = Get-VApp -Name New
$spec = New-Object VMware.Vim.VAppConfigSpec
$i = 0
$mastervapp.ExtensionData.VAppConfig.EntityConfig | %{
$spec.EntityConfig += $_
$spec.EntityConfig[$i].Key = $newvapp.ExtensionData.VAppConfig.EntityConfig[$i].Key
$i++
}
$newvapp.ExtensionData.UpdateVAppConfig($spec)
$vapp.ExtensionData.VAppConfig.EntityConfig
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
You can do something like this, but it assumes you have the same number of VMs in the Master as in the New vApp. There is no error checking!
This copies all settings, except the Key, from the master to the new vApp.
You can also copy only specific values, but that would require a change in the loop.
$mastervapp = Get-VApp -Name Master
$newvapp = Get-VApp -Name New
$spec = New-Object VMware.Vim.VAppConfigSpec
$i = 0
$mastervapp.ExtensionData.VAppConfig.EntityConfig | %{
$spec.EntityConfig += $_
$spec.EntityConfig[$i].Key = $newvapp.ExtensionData.VAppConfig.EntityConfig[$i].Key
$i++
}
$newvapp.ExtensionData.UpdateVAppConfig($spec)
$vapp.ExtensionData.VAppConfig.EntityConfig
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hartelijk bedankt LUC
Learned again from the master 🙂
GErt