Wednesday, October 9, 2019

vCD + NSX | How to get complete list of NSX edges in excel sheet

In one of our project, I was asked to extract a exhaustive report of NSX edges which should contain Edge ID, Edge Name, Edge Size, Datacenter Name and all other properties of NSX edge which can be included in the report.

I did it simply using PowerNSX (PowerShell module for NSX). Below is the script. If you understand powershell even a bit, you can add many more properties in this script.

Just copy and paste in Windows Powershell ISE(it work best with ISE console)

######Start

$vCD = Read-host "Enter vCD URL starting with https  "
$NSX = Read-host "Enter NSX Manager IP address  "

Connect-CIServer $vCD  #It will connect vCD

Connect-NsxServer -NsxServer $NSX #To connect NSX
$Orgs = Get-Org
$Edges = Get-NsxEdge
$myView = @()
Foreach ($Edge in $Edges) {
    $Report = [PSCustomObject] @{
    Edge_Name = $Edge.Name
Edge_ID = $edge.id
EdgeApplianceName_Active = $edge.edgeSummary.appliancesSummary.vmNameOfActiveVse
Edge_Size = $edge.fqdn
HA_Status = $edge.features.highAvailability.enabled
VcdOrg = ($orgs | where {$_.Id -match $edge.Tenant})
       }
    $MyView += $Report
}
$MyView | out-gridview
######End

# I personally prefer to take output as in "out-gridview" you can extract the report in .xlsx file as well.

1 comment:

  1. This is a very useful script to collect edge details. It helped me a lot to extract edge details before performing any activity and saves lots of efforts and time.

    Thanks Gautam, I know you have very good scripting knowledge. Keep it up...

    ReplyDelete

Sponsor

AD BANNER
Powered by Blogger.
The Magazine

Text Widget

Facebook

Extra Ads

AD BANNER

Welcome to my Notes!

Hello Folks, My name is Gautam Johar. Actively working on VMware Cloud and keen to learn new and latest cloud technologies in market. Love ...

Contact Form

Name

Email *

Message *

Followers



Labels

Translate

Breaking

Random Posts

Follow Us

On Linkedin

Recent Posts

Recent Comments

Header Ads

Popular Posts

Popular Posts

Recent Posts

Text Widget

Search This Blog

Copyright © test blog | Powered by Blogger
Design by Saeed Salam | Blogger Theme by NewBloggerThemes.com