The power of the VMware PowerCLI community

Last Week one of our colleagues asked the VMware team if we could provide him with all Hosts and VM’s that had access to a couple of DMZ VLAN’s. Most of the time that’s not really a problem, just use a script and select the right VLAN’s, right? In a single vSphere environment, maybe! But in our environment….. no. Due to the fact that we have shared environment build by different administrator’s, our environment consist is build up of different environments. We use Linked Mode to access multiple vCenter Servers.

So for getting the required information I needed to do a couple of things. first of all I needed to now which ESX hosts were connected to the DMZ directly. For this I used the following script (download here), from which I used the Observed Network, to see which Hosts (and VLAN’s) were connected with the DMZ.

I used the csv file to filter the hosts that included a link to the provided IP-ranges in the DMZ. That way I knew which physical hosts are connected to the DMZ.

But this was not the whole solution. The question was to make a list with all Hosts AND VM’s that are connected to the DMZ. So I needed another script to get a list with all VM’s that are linked to DMZ. Searching through all scripts available on the internet I couldn’t find the script I needed.

Many times I heard about the VMware PowerCLI community and the fast replies provided by several users within the community, but I never used it. Facing this problem I decided to see if all stories about this community were true. So at 4:09 AM I posted my question on the community and at 4:47 AM I got the script with which I was able to get infromation needed.

Here you can find the community post!

A special thanks to Luc Dekens (@LUCD22) for providing the script that quick!

Great resources for PowerCLI:

The VMware Community

Alan Renouf Blog

The PowerCLI book

Read More