VMware Cloud Community
MRoushdy
Hot Shot
Hot Shot
Jump to solution

Count VMs per portgroup

Get-vdportgroup | Get-V< -pipelinevariable VM | Select .....

And then what? I need to list portgroup name, along with the count of related VMs.

Thank you,

vEXPERT - VCAP-DCV - Blog: arabitnetwork.com | YouTube: youtube.com/c/MohamedRoushdy
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

Did you try like this?

Get-VDPortgroup |

  Select Name,

  @{N = 'VMCount'; E = {($_ | Get-VM).Count}}


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

0 Kudos
2 Replies
LucD
Leadership
Leadership
Jump to solution

Did you try like this?

Get-VDPortgroup |

  Select Name,

  @{N = 'VMCount'; E = {($_ | Get-VM).Count}}


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
MRoushdy
Hot Shot
Hot Shot
Jump to solution

Awesome!

I learn a lot from you.

Thanks,

vEXPERT - VCAP-DCV - Blog: arabitnetwork.com | YouTube: youtube.com/c/MohamedRoushdy
0 Kudos