Src/Public/Invoke-AsBuiltReport.VMware.NSXv.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
function Invoke-AsBuiltReport.VMware.NSXv {
    <#
    .SYNOPSIS
        PowerShell script which documents the configuration of VMware NSX-V in Word/HTML/XML/Text formats
    .DESCRIPTION
        Documents the configuration of VMware NSX-V in Word/HTML/XML/Text formats using PScribo.
    .NOTES
        Version: 0.4.1
        Author: Matt Allford
        Twitter: @mattallford
        Github: mattallford
        Credits: Iain Brighton (@iainbrighton) - PScribo module
 
    .LINK
        https://github.com/AsBuiltReport/AsBuiltReport.VMware.NSXv
    #>


    #region Script Parameters
    [CmdletBinding()]
    param (
        [String[]] $Target,
        [pscredential] $Credential,
        $StylePath
    )
    
    # If custom style not set, use default style
    if (!$StylePath) {
        & "$PSScriptRoot\..\..\AsBuiltReport.VMware.NSXv.Style.ps1"
    }
    
    foreach ($Server in $Target) {
        Try { 
            $script:NSXManager = Connect-NsxServer -vCenterServer $Server -Credential $Credential -ErrorAction Stop
        } Catch { 
            Write-Error $_
        }

        if ($NSXManager) {
            #Gather information about the NSX environment which are used in later sections within the script
            $script:NSXControllers = Get-NsxController
            $script:NSXEdges = Get-NsxEdge
            $script:NSXLogicalRouters = Get-NsxLogicalRouter
            $script:NSXFirewallSections = Get-NSXFirewallSection
            $script:NSXLogicalSwitches = Get-NSXLogicalSwitch
            $script:NSXFirewallExclusionList = Get-NsxFirewallExclusionListMember
            $script:NSXSecurityGroups = Get-NsxSecurityGroup
            $script:NSXSegmentIDs = Get-NSXSegmentIdRange
            $script:NSXTransportZones = Get-NsxTransportZone
            $script:NSXIPSets = Get-NsxIpSet
            $script:NSXMacSets = Get-NsxMacSet

            #Create major section in the output file for VMware NSX
            Section -Style Heading2 'NSX' {
                Paragraph 'The following section provides a summary of the VMware NSX configuration.'
                BlankLine
                #Provide a summary of the NSX Environment
                $NSXSummary = [PSCustomObject] @{
                    'NSX Manager Address' = $NSXManager.Server
                    'NSX Manager Version' = $NSXManager.Version
                    'NSX Manager Build Number' = $NSXManager.BuildNumber
                    'NSX Controller Count' = $NSXControllers.count
                    'NSX Edge Count' = $NSXEdges.count
                    'NSX Logical Router Count' = $NSXLogicalRouters.count
                    'NSX Distributed Firewall Sections' = $NSXFirewallSections.count
                    'NSX Logical Switch Count' = $NSXLogicalSwitches.count
                    'NSX Security Group Count' = $NSXSecurityGroups.count
                    'NSX Segment ID Count' = $NSXSegmentIDs.count
                    'NSX Transport Zone Count' = $NSXTransportZones.count
                    'NSX IP Set Count' = $NSXIPSets.count
                }
                $NSXSummary | Table -Name 'NSX Information' -List

                #If this NSX Manager has Controllers, provide a summary of the NSX Controllers
                if ($NSXControllers) {
                    Section -Style Heading3 'Controllers' {
                        $NSXControllerSettings = foreach ($NSXController in $NSXControllers) {
                            [PSCustomObject] @{
                                Name = $NSXController.Name
                                ID = $NSXController.ID
                                'IP Address' = $NSXController.IPAddress
                                Status = $NSXController.Status
                                Version = $NSXController.Version
                                'Is Universal' = $NSXController.IsUniversal
                            }
                        }
                        $NSXControllerSettings | Table -Name 'NSX controller Information'
                    }
                }

                if ($NSXSegmentIDs) {
                    Section -Style Heading3 'Segment IDs' {
                        $NSXSegmentIDSettings = foreach ($NSXSegmentID in $NSXSegmentIDs) {
                            [PSCustomObject]@{
                                'Segment ID' = $NSXSegmentID.id
                                'Segment Name' = $NSXSegmentID.name
                                'Segment ID Pool Begin' = $NSXSegmentID.Begin
                                'Segment ID Pool End' = $NSXSegmentID.end
                                'Is Universal' = $NSXSegmentID.IsUniversal
                            }
                        }
                        $NSXSegmentIDSettings | Table -Name 'NSX Segment IDs'
                    }
                }

                if ($NSXTransportZones) {
                    Section -Style Heading3 'Transport Zones' {
                        $NSXTransportZoneSettings = foreach ($NSXTransportZone in $NSXTransportZones) {
                            [PSCustomObject]@{
                                Name = $NSXTransportZone.Name
                                'Is Universal' = $NSXTransportZone.isUniversal
                                Description = $NSXTransportZone.Description
                                'Replication Mode' = $NSXTransportZone.ControlPlaneMode
                                'Attached Clusters' = $NSXTransportZone.clusters.cluster.cluster.name
                                'Associated Logical Switch #' = $NSXTransportZone.virtualwirecount
                                'CDO Mode Enabled' = $NSXTransportZone.CDOModeEnabled
                            }
                        }
                        $NSXTransportZoneSettings | Table -Name 'Transport Zones'
                    }
                }

                if ($NSXLogicalSwitches) {
                    Section -Style Heading3 'Logical Switches' {
                        $NSXLogicalSwitchSettings = foreach ($NSXLogicalSwitch in $NSXLogicalSwitches) {
                            $BackingPortGroup = $NSXLogicalSwitch | Get-NsxBackingPortGroup
                            $VMsAttachedToLogicalSwitch = $BackingPortGroup | Get-VM
                            [PSCustomObject]@{
                                Name = $NSXLogicalSwitch.Name
                                ID = $NSXLogicalSwitch.ObjectID
                                'Is Universal' = $NSXLogicalSwitch.IsUniversal
                                Description = $NSXLogicalSwitch.Description
                                'Control Plane Mode' = $NSXLogicalSwitch.ControlPlaneMode
                                'Attached VM #' = $VMsAttachedToLogicalSwitch.count
                            }
                        }
                        $NSXLogicalSwitchSettings | Table -Name 'Logical Switches'
                    }
                }

                #Create report section for NSX Edges
                Section -Style Heading3 'Edges' {
                    #Loop through each Edge to collect information
                    foreach ($NSXEdge in $NSXEdges) {
                        Section -Style Heading4 $NSXEdge.Name {
                            $NSXEdgeSettings = [PSCustomObject] @{
                                Name = $NSXEdge.Name
                                ID = $NSXEdge.ID
                                Version = $NSXEdge.Version
                                Status = $NSXEdge.Status
                                Type = $NSXEdge.Type
                                'Connected VNICs' = $NSXEdge.edgeSummary.numberOfConnectedVnics
                                'Edge Status' = $NSXEdge.edgeSummary.edgeStatus
                                'Is Universal' = $NSXEdge.isUniversal
                                'Edge HA Enabled' = $NSXEdge.features.highAvailability.enabled
                                'Deploy Appliance' = $NSXEdge.appliances.deployAppliances
                                'Appliance Size' = $NSXEdge.appliances.ApplianceSize
                                'Syslog Enabled' = $NSXEdge.features.syslog.enabled
                                'SSH Enabled' = $NSXEdge.cliSettings.remoteAccess
                                'Edge Autoconfiguration Enabled' = $NSXEdge.autoConfiguration.enabled
                                'FIPS Enabled' = $NSXEdge.EnableFIPS
                                'NAT Enabled' = $NSXEdge.features.Nat.enabled
                                'Layer 2 VPN Enabled' = $NSXEdge.features.l2Vpn.enabled
                                'DNS Enabled' = $NSXEdge.features.dns.enabled
                                'SSL VPN Enabled' = $NSXEdge.features.sslvpnConfig.enabled
                                'Firewall Enabled' = $NSXEdge.features.firewall.enabled
                                'IPSEC VPN Enabled' = $NSXEdge.features.ipsec.enabled
                                'Load Balancer Enabled' = $NSXEdge.features.loadBalancer.enabled
                                'DHCP Server Enabled' = $NSXEdge.features.dhcp.enabled
                                'Layer 2 Bridges Enabled' = $NSXEdge.features.bridges.enabled
                            }
                            $NSXEdgeSettings | Table -Name "NSX Edge Information" -List

                            #Loop through all of the vNICs attached to the NSX edge and output information to the report
                            #Show only connected NICs if using Infolevel 1, but show all NICs is InfoLevel is 2 or greater
                            Section -Style Heading5 "vNIC Settings" {
                                $NSXEdgeVNICSettings = foreach ($NSXEdgeVNIC in $NSXEdge.vnics.vnic) {
                                    [PSCustomObject] @{
                                        Label = $NSXEdgeVNIC.Label
                                        'VNIC Number' = $NSXEdgeVNIC.index
                                        Name = $NSXEdgeVNIC.Name
                                        MTU = $NSXEdgeVNIC.mtu
                                        Type = $NSXEdgeVNIC.Type
                                        Connected = $NSXEdgeVNIC.IsConnected
                                        'Portgroup Name' = $NSXEdgeVNIC.portgroupName
                                    }
                                }
                                $NSXEdgeVNICSettings | Table -Name "NSX Edge VNIC Information"
                            }

                            #Check to see if NAT is enabled on the NSX Edge. If it is, export NAT Rules
                            $NSXEdgeNATRules = $NSXEdge | Get-NsxEdgeNat | Get-NsxEdgeNatRule
                            if ($NSXEdgeNATRules) {
                                Section -Style Heading5 "NAT Rules" {
                                    $SNATRules = $NSXEdgeNATRules | Where-Object { $_.Action -eq "snat" }
                                    $DNATRules = $NSXEdgeNATRules | Where-Object { $_.Action -eq "dnat" }
                                    if ($SNATRules) {
                                        Section -Style Heading6 "SNAT Rules" {
                                            $SNATRuleConfig = foreach ($SNATRule in $SNATRules) {
                                                [PSCustomObject] @{
                                                    'Rule ID' = $SNATRule.RuleId
                                                    Action = $SNATRule.Action
                                                    Enabled = $SNATRule.Enabled
                                                    Description = $SNATRule.Description
                                                    RuleType = $SNATRule.RuleType
                                                    EdgeNIC = $SNATRule.vnic
                                                    OriginalAddress = $SNATRule.OriginalAddress
                                                    OriginalPort = $SNATRule.OriginalPort
                                                    TranslatedAddress = $SNATRule.TranslatedAddress
                                                    TranslatedPort = $SNATRule.TranslatedPort
                                                    Protocol = $SNATRule.Protocol
                                                    'SNAT Destination Address' = $SNATRule.snatMatchDestinationAddress
                                                    'SNAT Destination Port' = $SNATRule.snatMatchDestinationPort
                                                    'Logging Enabled' = $SNATRule.loggingEnabled
                                                }
                                            }
                                            $SNATRuleConfig | Table -Name "SNAT Rules" -List -ColumnWidths 50, 50
                                        }
                                    }#end if $SNATRules
                                    if ($DNATRules) {
                                        Section -Style Heading6 "DNAT Rules" {
                                            $DNATRuleConfig = foreach ($DNATRule in $DNATRules) {
                                                [PSCustomObject] @{
                                                    'Rule ID' = $DNATRule.RuleId
                                                    Action = $DNATRule.Action
                                                    Enabled = $DNATRule.Enabled
                                                    Description = $DNATRule.Description
                                                    RuleType = $DNATRule.RuleType
                                                    EdgeNIC = $DNATRule.vnic
                                                    OriginalAddress = $DNATRule.OriginalAddress
                                                    OriginalPort = $DNATRule.OriginalPort
                                                    TranslatedAddress = $DNATRule.TranslatedAddress
                                                    TranslatedPort = $DNATRule.TranslatedPort
                                                    Protocol = $DNATRule.Protocol
                                                    'DNAT Source Address' = $DNATRule.dnatMatchSourceAddress
                                                    'DNAT Source Port' = $DNATRule.dnatMatchSourcePort
                                                    'Logging Enabled' = $DNATRule.loggingEnabled
                                                }
                                            }
                                            $DNATRuleConfig | Table -Name "DNAT Rules" -List -ColumnWidths 50, 50
                                        }
                                    }#end if $DNATRules
                                }#end Section -Style Heading5 "NAT Rules"
                            }#End $NSXEdgeNATRules

                            #Check to see if Layer2 VPN is enabled on the NSX Edge. If it is, export the L2 VPN information
                            if ($NSXEdge.features.l2Vpn.enabled) {

                            }

                            #Check to see if DNS is enabled on the NSX Edge. If it is, export the DNS information
                            if ($NSXEdge.features.dns.enabled -eq "true") {
                                Section -Style Heading5 "DNS Settings" {
                                    $NSXEdgeDNSSettings = [PSCustomObject]@{
                                        'Edge Interface' = $NSXEdge.features.dns.listeners.vnic
                                        'DNS Servers' = ($NSXEdge.features.dns.dnsViews.dnsView.forwarders.IpAddress -join ", ")
                                        'Cache Size' = $NSXEdge.features.dns.cachesize
                                        'Logging Enabled' = $NSXEdge.features.dns.logging.enable
                                        'Logging Level' = $NSXEdge.features.dns.logging.loglevel
                                    }
                                    $NSXEdgeDNSSettings | Table -Name "$($NSXEdge.Name) DNS Configuration"
                                }
                            }

                            #Check to see if the SSL VPN is enabled on the NSX Edge. If it is, export the SSL VPN information
                            if ($NSXEdge.features.sslvpnConfig.enabled) {

                            }

                            #Check to see if the Edge is deployed with high availability. If it is, export the HA information
                            if ($NSXEdge.features.highAvailability.enabled) {

                            }

                            #Check to see if routing is enabled on the NSX Edge. If it is, export the routing information
                            if ($NSXEdge.features.routing.enabled) {

                            }
                            if ($NSXEdge.features.gslb.enabled) {

                            }
                            if ($NSXEdge.features.firewall.enabled) {

                            }
                            if ($NSXEdge.features.ipsec.enabled) {

                            }
                            if ($NSXEdge.features.loadbalancer.enabled) {

                            }
                            if ($NSXEdge.features.dhcp.enabled) {

                            }
                            if ($NSXEdge.features.bridges.enabled) {

                            }

                            #Check to see if Syslog is enabled on the NSX Edge. If it is, export the Syslog information
                            if ($NSXEdge.features.syslog.enabled -eq "true") {
                                Section -Style Heading5 "Syslog Settings" {
                                    $NSXEdgeSyslogSettings = [PSCustomObject]@{
                                        'Syslog Protocol' = $NSXEdge.features.Syslog.Protocol
                                        'Syslog Servers' = ($NSXEdge.features.Syslog.ServerAddresses.ipAddress -join ", ")
                                    }
                                    $NSXEdgeSyslogSettings | Table -Name "$($NSXEdge.Name) Syslog Settings"
                                }
                            }
                        }
                    }#End NSX Edge foreach loop
                }#End NSX Edge Settings

                Section -Style Heading3 'Distributed Firewall' {
                    #Check to see if any VMs are excluded from the NSX Distributed Firewall, and if they are, list them here
                    if ($NSXFirewallExclusionList) {
                        Section -Style Heading4 "Distributed Firewall Exclusion List" {
                            $NSXFirewallExclusionList | Select-Object Name | Table -Name "Distributed Firewall Exclusion List"
                        }
                    }
                    #Document the NSX DFW Sections
                    if ($NSXFirewallSections) {
                        Section -Style Heading4 "DFW Firewall Sections" {
                            $NSXFirewallSectionSettings = foreach ($NSXFirewallSection in $NSXFirewallSections) {
                                [PSCustomObject]@{
                                    Name = $NSXFirewallSection.Name
                                    ID = $NSXFirewallSection.ID
                                    Stateless = $NSXFirewallSection.Stateless
                                    Type = $NSXFirewallSection.Type
                                    '# of Rules' = $NSXFirewallSection.rule.count
                                    'Enable TCP Strict' = $NSXFirewallSection.tcpStrict
                                    'Enable User Identity at Source' = $NSXFirewallSection.useSid
                                }
                            }
                            $NSXFirewallSectionSettings | Table -Name "DFW Firewall Section Information" -List -ColumnWidths 50, 50
                        }

                        #For each Section in the DFW, loop through to get information about each rule within the secion and document each rule
                        foreach ($NSXFirewallSection in $NSXFirewallSections) {
                            #Get all NSX Rules for the current section
                            $NSXDFWRules = $NSXFirewallSection | Get-NsxFirewallRule 
                            if ($NSXDFWRules) {
                                Section -Style Heading4 "$($NSXFirewallSection.name) Firewall Rules" {
                                    $NSXDFWRuleInfo = foreach ($NSXDFWRule in $NSXDFWRules) {
                                        #Check to see if the current rule is enabled or disabled
                                        if ($NSXDFWRule.Disabled -eq "true") {
                                            $NSXDFWRuleStatus = "Disabled"
                                        } elseif ($NSXDFWRule.Disabled -eq "false") {
                                            $NSXDFWRuleStatus = "Enabled"
                                        }

                                        # If there is no source, the source must be any. Else specify the source.
                                        if (!$NSXDFWRule.Sources.Source.Name) {
                                            $NSXDFWRuleSource = "Any"
                                        } else {
                                            $NSXDFWRuleSource = ($NSXDFWRule.Sources.Source.Name -join ", ")
                                        }

                                        # If there is no destination, the destination must be any. Else specify the destination.
                                        if (!$NSXDFWRule.Destinations.Destination.Name) {
                                            $NSXDFWRuleDestination = "Any"
                                        } else {
                                            $NSXDFWRuleDestination = ($NSXDFWRule.Destinations.Destination.Name -join ", ")
                                        }

                                        # If there is no service, the service must be any. Else specify the service
                                        if (!$NSXDFWRule.Services.service.name) {
                                            $NSXDFWServiceName = "Any"
                                        } Else {
                                            $NSXDFWServiceName = ($NSXDFWRule.Services.service.name -join ", ")
                                        }

                                        [PSCustomObject]@{
                                            Name = $NSXDFWRule.Name
                                            ID = $NSXDFWRule.id
                                            Status = $NSXDFWRuleStatus
                                            Action = $NSXDFWRule.Action
                                            Direction = $NSXDFWRule.Direction
                                            'Packet Type' = $NSXDFWRule.PacketType
                                            'Source' = $NSXDFWRuleSource
                                            'Source Type' = ($NSXDFWRule.Sources.Source.Type -join ", ")
                                            'Source Negate' = $NSXDFWRule.Sources.Excluded
                                            'Destination' = $NSXDFWRuleDestination
                                            'Destination Type' = ($NSXDFWRule.Destinations.Destination.Type -join ", ")
                                            'Destination Negate' = $NSXDFWRule.Destinations.Excluded
                                            'Service Name' = $NSXDFWServiceName
                                            'Applied To' = $NSXDFWRule.appliedToList.appliedTo.name
                                            'Log Enabled' = $NSXDFWRule.Logged
                                        }
                                    }
                                    $NSXDFWRuleInfo | Table -Name "DFW Firewall Rules"
                                }
                            }

                        }#End Foreach NSX Firewall Sections
                    }#End if NSX Firewall Sections
                }#End NSX Distributed Firewall Section

                #This block of code retrieves information about synamic and static NSX Security groups
                if ($NSXSecurityGroups) {
                    Section -Style Heading3 'Security Groups' {
                        Section -Style Heading4 'Security Group Summary' {
                            #Create empty arrays that are used in the foreach loops below
                            $NSXSecurityGroupSummary = @()
                            $StaticNSXSecurityGroups = @()
                            $DynamicNSXSecurityGroups = @()
                            foreach ($NSXSecurityGroup in $NSXSecurityGroups) {
                                if ($NSXSecurityGroup.dynamicMemberDefinition) {
                                    $NSXSecurityGroupHashTable = [Ordered]@{
                                        'Name' = $NSXSecurityGroup.name
                                        'Scope' = $NSXSecurityGroup.scope.name
                                        'Is Universal' = $NSXSecurityGroup.IsUniversal
                                        'Inheritance Allowed' = $NSXSecurityGroup.InheritanceAllowed
                                        'Object ID' = $NSXSecurityGroup.objectID
                                        'Group Type' = "Dynamic"
                                    }
                                    $NSXSecurityGroupObject = New-Object PSObject -Property $NSXSecurityGroupHashTable
                                    $NSXSecurityGroupSummary += $NSXSecurityGroupObject
                                    #Add the security group to the list of Dynamic security groups
                                    $DynamicNSXSecurityGroups += $NSXSecurityGroup
                                } else {
                                    $NSXSecurityGroupHashTable = [Ordered]@{
                                        'Name' = $NSXSecurityGroup.name
                                        'Scope' = $NSXSecurityGroup.scope.name
                                        'Is Universal' = $NSXSecurityGroup.IsUniversal
                                        'Inheritance Allowed' = $NSXSecurityGroup.InheritanceAllowed
                                        'Object ID' = $NSXSecurityGroup.objectID
                                        'Group Type' = "Static"
                                    }
                                    $NSXSecurityGroupObject = New-Object PSObject -Property $NSXSecurityGroupHashTable
                                    $NSXSecurityGroupSummary += $NSXSecurityGroupObject
                                    #Add the security group to the list of Static security groups
                                    $StaticNSXSecurityGroups += $NSXSecurityGroup
                                }
                            }
                            #Export the information regarding both dynamic and static security groups
                            $NSXSecurityGroupSummary | Table -Name "Security Groups"

                            #If there are any static security groups in the environment, export specific information about the security groups, including the membership
                            if ($StaticNSXSecurityGroups) {
                                Section -Style Heading5 'Static Security Groups' {
                                    $StaticNSXSecurityGroupSettings = foreach ($StaticNSXSecurityGroup in $StaticNSXSecurityGroups) {
                                        [PSCustomObject]@{
                                            Name = $StaticNSXSecurityGroup.Name
                                            Description = $StaticNSXSecurityGroup.Description
                                            Members = ($StaticNSXSecurityGroup.member.Name -join ", ")
                                        }
                                    }
                                    $StaticNSXSecurityGroupSettings | Table -Name "Static Security Group Membership"
                                }
                            }

                            #If there are any dynamic security groups in the environment, export specific information about the security groups, including the dynamic criteria
                            if ($DynamicNSXSecurityGroups) {
                                Section -Style Heading5 'Dynamic Security Groups' {
                                    $DynamicNSXSecurityGroupSettings = foreach ($DynamicNSXSecurityGroup in $DynamicNSXSecurityGroups) {
                                        [PSCustomObject]@{
                                            Name = $DynamicNSXSecurityGroup.Name
                                            Operator = $DynamicNSXSecurityGroup.dynamicMemberDefinition.DynamicSet.DynamicCriteria.Operator
                                            Key = $DynamicNSXSecurityGroup.dynamicMemberDefinition.DynamicSet.DynamicCriteria.Key
                                            Criteria = $DynamicNSXSecurityGroup.dynamicMemberDefinition.DynamicSet.DynamicCriteria.Criteria
                                            Value = $DynamicNSXSecurityGroup.dynamicMemberDefinition.DynamicSet.DynamicCriteria.Value
                                        }
                                    }
                                    $DynamicNSXSecurityGroupSettings | Table -Name "Dynamic Security Group Membership"
                                }
                            }
                        }
                    }#End Section Security Groups
                }#End if NSXSecurityGroups

                if ($NSXIPSets) {
                    Section -Style Heading3 'IP Sets' {
                        $NSXIPSetConfiguration = foreach ($NSXIPSet in $NSXIPSets) {
                            [PSCustomObject]@{
                                Name = $NSXIPSet.Name
                                ID = $NSXIPSet.ObjectID
                                Description = $NSXIPSet.Description
                                'Is Universal' = $NSXIPSet.IsUniversal
                                'Inheritance Allowed' = $NSXIPSet.InheritanceAllowed
                                Members = ($NSXIPSet.Value -join ", ")
                            }
                        }
                        $NSXIPSetConfiguration | Table -Name 'IP Sets'
                    }#End Section IP Sets
                }#End if NSX IP Sets

                if ($NSXMacSets) {
                    Section -Style Heading3 'Mac Sets' {
                        $NSXMacSetConfiguration = foreach ($NSXMacSet in $NSXMacSets) {
                            [PSCustomObject]@{
                                Name = $NSXMacSet.Name
                                ID = $NSXMacSet.ObjectID
                                Description = $NSXMacSet.Description
                                'Is Universal' = $NSXMacSet.IsUniversal
                                'Inheritance Allowed' = $NSXMacSet.InheritanceAllowed
                                Members = ($NSXMacSet.Value -join ", ")
                            }
                        }
                        $NSXMacSetConfiguration | Table -Name 'Mac sets'
                    }#End Section Mac sets
                }#End if NSX Mac Sets

            }
            #Disconnect from the NSX Manager Server
            Disconnect-NsxServer
        }#End if NSX Manager
        #region Variable cleanup
        Clear-Variable -Name NSXManager
        #endregion Variable cleanup
    }
}