Quantcast
Channel: VMware Communities : Popular Discussions - vCloud Director PowerCLI
Viewing all articles
Browse latest Browse all 13334

Sample Script: Creating an Empty vApp with vCloud PowerCLI

$
0
0

Hi Everyone,

 

The New-CIVApp cmdlet does not allow us to create empty vApps (which can be useful when templating out network configurations, for example). This shortcoming can be overcome by calling the "ComposeVApp" method of a vDC directly. In case anybody else runs into this same problem, I've included my script. Note that it uses the first created organization vDC, so ymmv.

 

I also realize that I could probably get the vDC directly instead of going through ExtensionData, but I think that this illustrates that "otherwise hidden" parameters can be discovered rather easily through this object ("Get-Member" is your friend!)

 

$newvapp = New-Object VMware.VimAutomation.Cloud.Views.ComposeVAppParams

$newvapp.Name = "My New vApp"

$newvapp.Description = "An empty vApp"

$result = (DefaultCIServers[0].ExtensionData.OrganizationReferences.OrganizationReference | Where-Object {$_.Name -like "organization name"}).GetCIView().VDCs.VDC[0].GetCIView().ComposeVApp($newvapp)

$result.tasks.task.wait($null)

Write-Host "$($result.tasks.task.Operation) $($result.tasks.task.status)


Viewing all articles
Browse latest Browse all 13334

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>