These days I am busy exploring NSX Rest API in my lab and during the process I came to know about a cool tool named PowerNSX and decided to dedicate a blog on this to give respect to creator of this tool.
What is PowerNSX
PowerNSX is a PowerShell module that abstracts the NSX API to a set of easily used PowerShell functions. PowerNSX enables NSX administrators to drive their infrastructure programmatically.
PowerNSX add additional functionality to extend the capabilities of NSX along with exposing the existing Update, Remove and Get operations for all key NSX functions beyond the native UI or API.
Note: VMware does not support this module, and PowerNSX comes with no warranties express or implied. It is advisable to test this in Lab before using in a production environment.
To install PowerNSX on your system, make sure following software’s are already installed
- Dotnet framework 4.5
- Powershell v3
- PowerCli v6
PowerNSX provides an installer script that you can use to use to install all of those at once. This script will go and download Power-shell and other correct versions including pointing you to the right PowerCli installer required for installation of PowerNSX.
Steps for manual installation can be read from this wiki page.
Automated installation using the script looks like below
Now you can launch another instance of power-shell and import the PowerNSX module by running command: Import-Module PowerNSX.
View available NSX PowerShell commands
All commands that can be used with PowerNSX can be listed by typing command: get-command -module PowerNSX
It will return a long list of available commands and the list is damn large.
Testing connection to PowerNSX
You can test the connection to PowerNSX to see if it is working fine or not by firing simple get commands as shown below:
Now you can play around various options to automate things in your lab/prod environment. I think its a great tool and I am looking forward to use it more on day to day basis.
VMworld 2016 Session NET7514: Using PowerShell and Python for Automation and Management of VMware NSX for vSphere
I hope you enjoyed reading this post. Feel free to share this on social media if it is worth sharing. Be sociable