MRoushdy
Hot Shot
Hot Shot

Count VMs per portgroup

Jump to solution

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

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

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

Awesome!

I learn a lot from you.

Thanks,

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