VMware Cloud Community
kivmark
Contributor
Contributor
Jump to solution

How to count the number of Vm's in an ESXi server using command line

I want to know the number of Vm's running over ESXi. What is the command for it.. ??

'vim-cmd vmsvc/getallvms'

This command list out the vm's running oover the ESXi server, but i want the number (whole number)

Please help..

Thank You,

M@rk!V

Reply
0 Kudos
1 Solution

Accepted Solutions
pavitb
Enthusiast
Enthusiast
Jump to solution

Hi

You can use this PowerCLI command to get a VM count:

Connect-VIServer -Server "ESXi host or vCenter server"

(Get-VM -Location "ESXi host").count

Pavit

View solution in original post

5 Replies
pavitb
Enthusiast
Enthusiast
Jump to solution

Hi

You can use this PowerCLI command to get a VM count:

Connect-VIServer -Server "ESXi host or vCenter server"

(Get-VM -Location "ESXi host").count

Pavit

kivmark
Contributor
Contributor
Jump to solution

Can you please tell me using the esxcli ??

Reply
0 Kudos
Madmax01
Expert
Expert
Jump to solution

Hello,

if you like to query over putty > try: 

esxcli network vm list |wc -l

Best regards

Max

kivmark
Contributor
Contributor
Jump to solution

Thanks Max.. Smiley HappySmiley HappySmiley Happy

Reply
0 Kudos
jasoncain_22
Enthusiast
Enthusiast
Jump to solution

were you able to get this to work?

The "lwc -l" switch is not recognized for my version.

Reply
0 Kudos