A start for those wanting to learn powercli but were afraid to ask.

Why use powercli, you can do everything from the gui people say.
Yeah sure you can do everything from the gui, sort of.

Let’s say you have three vcenter servers and eighteen clusters and 17 thousand vms and want to find out.

  • Hosts in vcenter2 cluster 9
    • o  
      connect-viserver vcenter1,vcenter2,vcenter3 | get-cluster cluster9 | get-vmhosts | sort name 
  • vms running in cluster 9
    • o   
      get-cluster cluster9 | get-vm | sort name 
  • vms powered on in cluster9
    • get-cluster cluster9 | get-vm | where {$_.PowerState -eq "PoweredOn"}
  • vms powered on with 2 cpus on cluster9
    • o  
      get-cluster cluster9 | get-vm | where {$_.PowerState -eq "PoweredOn"} | where {$_.NumCpu -eq "2"}
  • vms powered on with a note containing the word whackdiddy
    • get-vm | where {$_.PowerState -eq "PoweredOn"} | where {$_.Notes -like "*whackdiddy*"}

To work out what you can filter by choose an existing guest and get full details like this..

get-vm guestname | fl

Where guestname is the name of one of your vm’s.

Once you have the basics you will find it much easier to get information with powercli than with the gui and so much quicker.