$Creds = Get-Credential $VCs = @('mgmt01-vc01.example.local','comp01-vc01.example.local') $VIConns = Connect-VIServer -AllLinked $VCs -Credential $Creds $NSXConns = $VCs | % { Connect-NsxServer -vCenterServer $_ -Credential $Creds } $Info = foreach ($nsx in $LabNSXConns) { foreach ($edge in ( Get-NsxEdge -Connection $nsx )) { $Interfaces = Get-NsxEdgeInterface -Edge $edge -Connection $nsx $Interface_Info = foreach ($Interface in $Interfaces) { If ($Interface.addressGroups.addressGroup.secondaryAddresses.ipAddress) { $IP = $Interface.addressGroups.addressGroup.primaryAddress+" "+$Interface.addressGroups.addressGroup.secondaryAddresses.ipAddress } else { $IP = $Interface.addressGroups.addressGroup.primaryAddress } if ($Interface.portgroupName) { [PSCustomObject]@{ EdgeName = $Edge.Name Name = $Interface.Name Label = $Interface.label PortGroup = $Interface.portgroupName IP = $IP }} } $EdgeInfo = [PSCustomObject]@{ Name = $edge.name RemoteAccess = $edge.cliSettings.remoteAccess LogEnabled = $edge.features.syslog.enabled LogProtocol = $edge.features.syslog.protocol LogAddress = $edge.features.syslog.serverAddresses.ipAddress HA_enabled = $edge.features.highAvailability.enabled LastRule = ($edge.features.firewall.firewallRules.firewallRule | select action -Last 1).action FirewallOn = $edge.features.firewall.enabled Type = $edge.edgeSummary.edgeType Interfaces = $Interface_Info } $EdgeInfo } foreach ($edge in (Get-NsxLogicalRouter -Connection $nsx )) { $Interfaces = Get-NsxLogicalRouterInterface -LogicalRouter $edge -Connection $nsx $Interface_Info = foreach ($Interface in $Interfaces) { If ($Interface.addressGroups.addressGroup.secondaryAddresses.ipAddress) { $IP = $Interface.addressGroups.addressGroup.primaryAddress+","+$Interface.addressGroups.addressGroup.secondaryAddresses.ipAddress } else { $IP = $Interface.addressGroups.addressGroup.primaryAddress } [PSCustomObject]@{ EdgeName = $Edge.Name Name = $Interface.Name Label = $Interface.label PortGroup = $Interface.connectedToName IP = $IP } } $EdgeInfo = [PSCustomObject]@{ Name = $edge.name RemoteAccess = $edge.cliSettings.remoteAccess LogEnabled = $edge.features.syslog.enabled LogProtocol = $edge.features.syslog.protocol LogAddress = $edge.features.syslog.serverAddresses.ipAddress HA_enabled = $edge.features.highAvailability.enabled LastRule = ($edge.features.firewall.firewallRules.firewallRule | select action -Last 1).action FirewallOn = $edge.features.firewall.enabled Type = $edge.edgeSummary.edgeType Interfaces = $Interface_Info } $EdgeInfo } }