When managing
vApps in the cloud, you might need to obtain information about the NIC settings
of the associated virtual machines.
Prerequisites
Verify that you are connected
to a
vCloud
Director
server.
Procedure
-
Retrieve the
organization for which you want to generate the report.
$myOrg = Get-Org -Name 'MyOrg'
-
Retrieve all vApps in
the organization.
$vApps = Get-CIVApp -Org $myOrg
-
Populate an array with
the information that you want to report.
$vAppNetworkAdapters = @()
foreach ($vApp in $vApps) {
$vms = Get-CIVM -VApp $vApp
foreach ($vm in $vms) {
$networkAdapters = Get-CINetworkAdapter -VM $vm
foreach ($networkAdapter in $networkAdapters) {
$vAppNicInfo = New-Object "PSCustomObject"
$vAppNicInfo | Add-Member -MemberType NoteProperty -Name VAppName -Value $vApp.Name
$vAppNicInfo | Add-Member -MemberType NoteProperty -Name VMName -Value $vm.Name
$vAppNicInfo | Add-Member -MemberType NoteProperty -Name NIC -Value ("NIC" + $networkAdapter.Index)
$vAppNicInfo | Add-Member -MemberType NoteProperty -Name ExternalIP -Value $networkAdapter.ExternalIpAddress
$vAppNicInfo | Add-Member -MemberType NoteProperty -Name InternalIP -Value $networkAdapter.IpAddress
$vAppNetworkAdapters += $vAppNicInfo
}
}
}
Running this script
retrieves the names of the virtual machines and their associated vApp, the IDs
of the NICs of the virtual machines, and external, and internal IP addresses of
the NICs.
-
Display the report on
the screen.