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

Script Slow: VCD Pulling External/Internal IP from Org/vApp

$
0
0

I was curious if any of the script masters could review the following.

 

This works fine, but it is pretty slow.  I'm hoping that the speed can be improved.  When I query against an organization, vapp, vms, networks that has 900+ vm, it is 4-6 hours to complete.

 

I would think that I could do this quicker, but I need a set of fresh eyes.

 

*The echos are just so I know that the script is doing something.  Watching a black screen for half a day is boring.*

 

$myOrg = Get-Org -Name "MyCoolOrg"
$vApps = Get-CIVApp -Org $myOrg
$vAppNetworkAdapters = @()
foreach ($vApp in $vApps) {
        $vAPPLabel = "vAPP:" + " " + $vApp.Name
        echo $vAPPLabel
        $vms = Get-CIVM -VApp $vApp
        foreach ($vm in $vms) {
                $vmLabel = "VM Name:" + " " + $vm.Name
                echo $vmLabel
                $vAppNicInfo = Get-CINetworkAdapter -VM $vm | Select  `
                                                                    @{Label="vApp";Expression={$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

 

Thanks in advance.

-Kevin


Viewing all articles
Browse latest Browse all 13334

Trending Articles



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