Leveraging PowerShell to Deploy Virtual Network Tiers with VMware NSX

Chris Wahl · Posted on2015-01-072019-06-25

I spend a lot of time building virtual networking tiers using VMware NSX, and so I wrote a few PowerShell scripts that automate the build and removal process and open sourced them on GitHub here. I’m by no means a wizard at this sort of thing, but I’ve tried to make the code as clean, commented, and error-handling friendly as I could within the past few rounds of commits.

The documentation is rather ugly, and there are more things I’d like to do with the project. If you were following Matt Brender’s really awesome Commitmas project, perhaps you’d consider floundering around GitHub with me and helping with the docs or features. 🙂

Requirements

PowerShell 4.0, because I like the Invoke-WebRequest cmdlet.

PowerCLI 5.x (tested with 5.8), required to pull the vCenter MoRefs for the NSX API requests. I’m open to better ways to do this to avoid needing vCenter at all.

A functional VMware NSX installation: manager, controllers, prepared cluster, and transport zone. View the Working with NSX posts if you’ve yet to do this part. Yes, I could automate this as well, but I rarely find myself standing up net-new installations when compared to standing up (and removing) virtual networks. Prioritization of my time. 🙂

[symple_box color=”red” fade_in=”false” float=”center” text_align=”left” width=””]Disclaimer: don’t use this in production unless you’re pretty sure of exactly what you’re doing. Even then, I take no responsibility for what happens. :)[/symple_box]