I note that PowerCLI only has the following commandlets to manage vApps:
What none of these commandlets seem to offer is a way of manipulating the vApp "Start Order".
Is the vSphere Web Client the only way to set a vApp Start Order?
Or are there any APIs that can allow us to set the start order through scripts?
Seems I was wrong with that, you can change the start order of VMs in a vApp.
Quick example: simple vApp with 3 VMs in there. The default Start Order
With the following snippet I cam change that to 2 start groups
$vAppName = 'vApp1'
$vapp = Get-VApp -Name $vAppName
$vmOrder = @(
@{
Group = 1
VM = @('VM2','VM3')
},
@{
Group = 2
VM = @('VM1')
}
)
$spec = New-Object VMware.Vim.VAppConfigSpec
$spec.EntityConfig = $vapp.ExtensionData.VAppConfig.EntityConfig
foreach($group in $vmOrder){
$spec.EntityConfig | where{$group.VM -contains $_.Tag} | %{
$_.StartOrder = $group.Group
}
}
$vapp.ExtensionData.UpdateVAppConfig($spec)
And the start order is now exactly as we specified in $vmOrder
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
According to an old response from LucD, it wasn't possible to change this with PowerCLI. I don't think much has changed there.
Is PowerCLI representative of all APIs then?
In other words is it true to say, "If you can't do it in PowerCLI, then don't bother looking elsewhere like vCenter API"?
Seems a bit odd, it makes automated/scripted deployments difficult.
Seems I was wrong with that, you can change the start order of VMs in a vApp.
Quick example: simple vApp with 3 VMs in there. The default Start Order
With the following snippet I cam change that to 2 start groups
$vAppName = 'vApp1'
$vapp = Get-VApp -Name $vAppName
$vmOrder = @(
@{
Group = 1
VM = @('VM2','VM3')
},
@{
Group = 2
VM = @('VM1')
}
)
$spec = New-Object VMware.Vim.VAppConfigSpec
$spec.EntityConfig = $vapp.ExtensionData.VAppConfig.EntityConfig
foreach($group in $vmOrder){
$spec.EntityConfig | where{$group.VM -contains $_.Tag} | %{
$_.StartOrder = $group.Group
}
}
$vapp.ExtensionData.UpdateVAppConfig($spec)
And the start order is now exactly as we specified in $vmOrder
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Cool!
Ah! I had just returned with something I had found, which I believe amounts to the same thing...
https://vwiki.co.uk/vApp_Script_Extracts_and_Examples
This is good, I shall pass this to my developers and get them going with this.
Cheers all!
Should I be able to do this via other APIs?
vSphere API?
I understand some of the management code is developed in C#.
The API methods stay the same, you just need to call them from the C# framework.
They can use the PowerShell script as a prototype :smileygrin:
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
If I have more than one VM in a start order group, and I have "waitingForGuest" set to True, will vCenter wait until all VMs in the group are detected as started via VMTools before moving onto the next group or just the first one?
I have been told that VMs using PCoIP or Blast cannot have their desktop connections brokered when they are part of a vApp, is this true?
Google is simply coming with too many hits for me to quickly find anything that confirms or denies this.
Yes, I assume that WaitingForGuest will mean that all VMs in that group have to be detected, before the next group will be started.
I don't know if VMs in a vApp, that use PCOIP, can not be brokered.
You could ask in the Horizon community?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Yup! I think I will.