List VMs in PortGroups

While documenting the VI that I'm working on at present, I had cause to provide a list of which VMs were in which PortGroups. Now I have done this before but it was hardly pretty when I cut and pasted the script into a document or email so I've been back to make a quick enhancement to the script.

The output now comes as HTML, an example of which you can see below:

HTML Output from PowerShell Script

As before the script is simply called on its own to return a full list of VMs in PortGroups or an optional parameter can be supplied to filter the results. It's not that quick to execute but then it's not necessarily something that you'd need to run every five minutes anyway.

The script is
Get-VMPortGroups1.ps1