1

I am trying create a on-liner script which gives an outputs of Hosts and vm's counts in a vcenter cluster like as below.

enter image description here

Just using a sample oneliner Get-VMHost | Select @{N=“Cl“;E={Get-Cluster -VMHost $_}} Name, @{N=“NumVM“;E={($_ | Get-VM).Count}} | Sort Cluster, Name

any Ideas?? Thanks in advance

Regards, Subash.

1 Answer 1

2

A bit long for a one-liner, but

get-cluster | select @{n="cluster";e={$_.name}}, @{n="hosts";e={($_ | get-vmhost).count}}, @{n="vms";e={($_ | get-vm).count}} | sort cluster | ft -auto 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.