Which VMs are in which Port Groups

This took me a little while to get sorted as I had a gap in my PowerShell knowledge around the handling and formating of nested objects. A bit of exploration with get-member and I came up witha working script. It’s based on a post by Hugo Peeters and lists the VMs that are connected to (or belong to) a particular Port Group.

I wanted to know this as I was producing some infrastructure diagrams for a customer and wanted to know the names of VMs in a cluster for each Port Group without having to visit each ESX server. Continue Reading