listing vms from a portgroup

I was recently asked to get a list of all VMs in a certain VLAN along with OS and IP address.  To do that…

get-vdportgroup “<name of port group>” | get-vm | get-guest | select vm, ipaddress, osfullname | ft -autosize

if you happen to be on a standard switch, replace get-vdportgroup with get-virtualportgroup -name <name of portgroup>

 

%d bloggers like this:
Bitnami