Again, I don't use VCD, but this is a relative example
$vApps=Get-vApp
$vms=get-vm | Where-Object {$_.vapp -like $vapps}
$Nics=$vms |get-vmnetworkinterface
Now that I have all the data I need, I just need to filter it down with the foreach statements.....
Also, it looks like there really isn't much point to your "Foreach ($vapp in $vapps)" loop
You could do "Get-CIVapp | get-CIVM" to get all your VMs, and for your vapp label, just do "$vm.civapp.name"
Alright, you convinced me I am just going to rewrite this for you real quick....
$myOrg = Get-Org -Name "MyCoolOrg"
$vApps = Get-CIVApp -Org $myOrg
$vAppNetworkAdapters = @()
$vms= $vapps | Get-CIVM
$allnics= Get-CIVM | Get-CINetworkAdapter
$vmLabel = "VM Name:" + " " + $vm.Name
echo $vmLabel
$vAppNicInfo = $allnics| Select `
@{Label="vApp";Expression={$_.vm.vApp.name}}, `
@{Label="VM";Expression={$_.vm.name}}, `
@{Label="NIC";Expression={$_.Index}}, `
@{Label="Internal IP Address";Expression={$_.IPAddress}}, `
@{Label="External IP Address";Expression={$_.ExternalIPAddress}}
$vAppNetworkAdapters += , $vAppNicInfo
$vAppNetworkAdapters | export-csv c:\MyCoolOrg.csv -NoTypeInformation
Here I was able to take out all the loops, so it won't give you a "Status" as you were having it do before, but it should run MUCH faster since it won't have to do several hundred Gets.....
Also I completed this using the reference http://pubs.vmware.com/vsphere-51/topic/com.vmware.powercli.cmdletref.doc/CIVM.html
So i haven't been able to test, you may want to make sure it work with just one get-civm or something first