Hi,
I'm trying to get all Vm's and thier external ip address, to do some scripted DNS.
But it takes almost 20 minutes to complete for 136 machines.
@ PowerCLI 5.1 Release 2 build 1012425 & Powershell 2.0
$vAppNetworkAdapters = @()$vAppsVms = @()$vApps = @()$myOrg = $null$vCloud = $null$vCloud = Connect-CIServer -Server "host.contoso.com" -Credential (Get-Credential -Credential "User")if($vCloud -ne $null){Write-Host "Is connected: $($vCloud.IsConnected)"}$myOrg = Get-Org -Name "Development"$vApps = Get-CIVApp -Org $myOrg #Count: 8$vAppsVms = Get-CIVM -VApp $vApps #Count: 136Measure-Command {$vAppsVms | %{##get-externalnetwork$adapter = Get-CINetworkAdapter -VM $_ -Primary $trueWrite-host ("Vm: " + $_.Name + ", external ip: " + $adapter.ExternalIPAddress)}}#Execution Time#Days : 0#Hours : 0#Minutes : 19#Seconds : 6#Milliseconds : 152#Ticks : 11461522833#TotalDays : 0,0132656514270833#TotalHours : 0,31837563425#TotalMinutes : 19,102538055#TotalSeconds : 1146,1522833#TotalMilliseconds : 1146152,2833
20 minutes is not so bad you say? Well, we intend to get around a thousand machines running in this enviroment, looking at a 3 hour execution time.
I've tried to extract all the network adapters first, and then doing selects, but it takes almost exactly the same amount of time.
Measure-Command {$adapters = Get-CINetworkAdapter -vm $vAppsVms -Server $vCloud}
Anyone got any pointers? I really wan't to find out if there's a slowdown somewhere on our servers, or if it is just the implementation of the "Get-CINetworkAdapter" command, and if there is a way around it.
Best Regards
Daniel