During the development of my automated NSX-T 2.0 lab deployment script, I had created several PowerCLI functions using the new NSX-T cmdlets and NSX-T APIs to help me test and troubleshoot. I finally got a chance to clean up the code as well as package them all up into an NSXT.psm1 module which hopefully can benefit others. For those of you who are looking for a primer on how to get started with the new NSX-T PowerCLI cmdlets and the NSX-T APIs, check out this awesome post from Romain Decker.
The NSXT module contains the following 8 functions:
Below are examples of using each of the functions and before you can make use of the functions, be sure to login to your NSX-T instance by using the Connect-NsxtServer cmdlet.
The Get-NSXTManager returns some basic information about the NSX-T Manager which you are connected to including its ID and SHA256 Thumbprint which is useful for the initial configuration of the management and control cluster setup.
The Get-NSXTController returns all NSX-T Controllers that has joined the NSX-T Manager. This is a quick way to retrieve their cluster status without having to jump over to the NSX-T Manager UI. You also have the option to filter on a specific controller by simply providing the -Id parameter as shown in the screenshot below.
The Get-NSXTFabricNode can return multiple types of nodes such as an ESXi, NSX-T Edge or even KVM host and hence the generic name as it is referred to in the NSX-T APIs. By default, it will return all node types but you have the option of filtering out either ESXi hosts by specifying the -ESXi parameter or Edge hosts by specifying the -Edge parameter as shown in the second screenshot. Depending on the node types, you will get different pieces of information such as the underlying OS and Version. This function is handy to see if the NSX-T VIBs have been installed and its respective management and controller status.
The Get-NSXTComputeManager returns vCenter Servers that have registered with the NSX-T deployment. You will find useful information such as the server version and its current connection status.
The Get-NSXTIPPool returns list of IP Pools that have been created. You will find configuration details about the IP Pool including usage data which can be helpful to see how many available IP Addresses are left for a given pool.
The Get-NSXTTransportZone returns all Transport Zones which can either be of type VLAN or Overlay.
The Get-NSXTLogicalSwitch returns all Logical Switches that have been created along with other useful details such as the admin status and number of ports
The Get-NSXTFirewallRule returns the list of all firewall rule sections that have been configured which provides high level details such as the type, whether it is stateful or stateless and number of individual firewall rules. If you wish to inspect the individual firewall rules, you can then pass in the -Id of a specific firewall rule section in which the individual firewall rules will be displayed as shown in the screenshot below.