, ,

Get list of edge gateways connected to Internet (KB#00105)

Hello Guys,

I used to get such requests from customers so I thought to share this one to web. Many of you might know this but I am sure that many will have benefit from this post.

My colleagues too requested to share this trick to get the edge gateway name which are connected to internet. 

This sounds tricky but very simple. Try your thought before scroll down and comment :)

If not getting any idea then continue reading it. So, any edge gateway connected to internet through external network, right? and it has a name :) let's say in our case that name is InternetPG. I am assuming that you know the basic VCD stuff like what is the external network and how can we connect an edge gateway to the internet. If not then its time to start the study for the sake of new year. LOL!

Logic is, get the edge gateway name where connected external network name like InternetPG. Now, use this logic in powercli


Connect-CIServer mylabs.vcnotes.in #just to connect VCD
Get-EdgeGateway | Where {$_.ExtensionData.Configuration.GatewayInterfaces.GatewayInterface.name -clike "InternetPG"} | Select Name, orgvdc | out-gridview

I like to take output in gridview, if you want, you can remove out-gridview in above command. You will have output like below one.



Enjoy the year end guys!


2 comments:

  1. Customer always wants more. Upon his request to share the public IP address also which is assigned to edge interface, I created below set of command. It will give you all IPs and then you can do some magic in excel file to get the public IP address.

    $myView = @()
    foreach ($f in $ff){
    $Report = [PSCustomObject] @{
    EdgeName = $f.Name
    OrgvDCName = $f.OrgVdc
    InterNet_IP= $f.ExtensionData.Configuration.GatewayInterfaces.GatewayInterface.subnetparticipation.ipaddress
    }
    $MyView += $Report
    }
    $MyView | Out-File C:\Temp\report2.csv

    ReplyDelete