VMware Cloud Community
JayhawkEric
Expert
Expert

Get External IP for VM within vApp

I'm trying to query vCD for the External IP address for a specific VM within a vApp.  I can get the VM and some other information but am having a hard time getting the External IP since it's in a fenced configuration.  I also looked at pulling the IP Allocation list and then parsing that but I can't seem to get very far that way either.

Any help would be appreciated.

VCP5-DV twitter - @ericblee6 blog - http://vEric.me
0 Kudos
4 Replies
JayhawkEric
Expert
Expert

I finally found what I needed.

$VM = get-civm "VM Name"

($VM.ExtensionData.Section | Where {$_.GetType().Name -eq "NetworkConnectionSection" }).NetworkConnection | Select ExternalIpAddress
VCP5-DV twitter - @ericblee6 blog - http://vEric.me
0 Kudos
CSIEnvironments
Enthusiast
Enthusiast

Yip same as doing this:

$VM = get-civm "VM Name"
$vm.ExtensionData.GetNetworkConnectionSection().NetworkConnection[0].ExternalIpAddress

or

(get-civm "VM Name").ExtensionData.GetNetworkConnectionSection().NetworkConnection[0].ExternalIpAddress

JayhawkEric
Expert
Expert

That's much cleaner and gives a better output for what I'm doing with the IP

Thank you!!!

VCP5-DV twitter - @ericblee6 blog - http://vEric.me
0 Kudos
CSIEnvironments
Enthusiast
Enthusiast

Cool no problem Smiley Happy

0 Kudos