Powershell report on NSX IP Pools

While troubleshooting and NSX install I began wondering about the NSX IP pools and what was being used in them. I still need to look up the allocated IPs and report on the objects using them (name, type) but for now the (very basic) report spits back IP pool name, the configured ranges, the total IPs in the ranges, the number of IPs used and which specific IPs are used.

Note when you go to configure pools, if you want to allocate disjointed ranges you need to separate them with commas – this is no longer shows in the UI with 6.3. Also, to add single IPs just make a range out of them like: 192.168.2.50-192.168.2.50, 192.168.2.52-192.168.2.52, 192.168.2.55-192.168.2.55.

The script leverages a shorter version of the NSXAPI function I stole from Chris Wahl a while back.

I’ve only tested with Powershell 5.0 – the original NSXAPI function created a new type which errors in PS5: