VMware Cloud Community
mattbondie
Contributor
Contributor
Jump to solution

Script to report number of Windows VM's per host

I'm try to get a report of only the number of Windows VM's per esx host. The report needs to show the host names and the number of windows VM's on each. Can anyone help?

Regards

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

Try like this.

The script assumes that the VMware Tools are installed on all VMs.

Get-VMHost |

Select Name,@{N='WinVM';E={(Get-VM -Location $_ | where{$_.Guest.OSFullName -match "Windows"}).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

Try like this.

The script assumes that the VMware Tools are installed on all VMs.

Get-VMHost |

Select Name,@{N='WinVM';E={(Get-VM -Location $_ | where{$_.Guest.OSFullName -match "Windows"}).Count}}


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

0 Kudos
mattbondie
Contributor
Contributor
Jump to solution

Perfect thanks!

0 Kudos