I’m sure that someone somewhere has written a script exactly like this in the past but I wanted to write my own for a number of reasons. While I’ll probably never be a PowerCLI hero, it really doesn’t hurt to keep in practice and hone your skills.
Let’s start with what I want to accomplish. I’m working with an ESX 3.5 web hosting environment and there’s a new project in the pipelines. A brace of new servers are required and they’ll be on a new VLAN. The VLAN has been created and configured on the various switches that the ESX hosts connect to but now of course a corresponding PortGroup is required. (Actually two are needed – complex project.) Now we’re not talking about a huge number of hosts here. It would probably only take 10 minutes to do it by hand using the VI client. It’ll take me longer to write this post! However, it is something that happens relatively often in this environment so it’s worth taking the time to write a script. Continue Reading