VMware Cloud Community
mavelite
Enthusiast
Enthusiast

Get metadata from VM within vAppTemplate

I am trying to obtain the MetaData currently created on a VM within a vAppTemplate in a vCloud Catalog.

If the vApp is deployed to my cloud I can get the metadata without issues with the below code:

$Sourcetemplate = Get-CIVM -name $SourceVM

$DestinationTemplate = get-CIVM -name $DestinationVM

$metadata = $sourceVM.ExtensionData.GetMetadata()

$DestinationVM.ExtensionData.CreateMetaData($metadata)


But I'd like to skip the deployment of the vApp just to get it's metadata. I know I can make a REST call to get the info but I'd like to stick solely within powershell. Anyone have any thoughts?


Thanks

Mav

0 Kudos
1 Reply
Brian_Graf
Enthusiast
Enthusiast

This is possible, but you'll need to dig into the actual template in the catalog. for examples:

PowerCLI C:\> $temp = Get-Catalog "Brian Graf" | Get-CIVAppTemplate "vRB std w/PowerCLI 5.8 -BG"


The following will display all the VM's within the template. there are several ways you can get metadata off those vms

$temp.ExtensionData.Children.vm

You can get the metadata off of a specific VM by specifying it's order

$temp.ExtensionData.Children.vm[2].Getmetadata()


Hope this helps.

Senior Product Manager - Distributed Resource Management | @vBrianGraf
0 Kudos