Number of VM’s per Host
1 2 3 4 5 6 7 8 9 10 |
#Command Get-VMHost | Select @{N=“Cluster“;E={Get-Cluster -VMHost $_}}, Name, @{N=“Number of VMs“;E={($_ | Get-VM).Count}} | Sort Cluster, Name #Output Example Cluster Name Number of VMs ------- ---- ------------- esxi6-nuc1.vcallaway.com 8 Cluster 2 esxi-01.vcallaway.com 1 Cluster 2 esxi-02.vcallaway.com 0 Cluster 2 esxi-03.vcallaway.com 2 |
If you want to pipe out the result to a file simply add:
1 |
| Export-CSV -NoTypeInformation C:\path_to_output_directory |
Number of VM’s per Datastore
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
#Command Get-Datastore | Select Name, @{N="Num of VMs";E={@($_ | Get-VM).Count}} | Sort Name #Output Example Name Num of VMs ---- ----- datastore1 0 datastore1 (1) 0 datastore1 (2) 0 iSCSI_Cluster_LUN1 1 iSCSI_Cluster_LUN2 0 iSCSI_Cluster_LUN3 1 iSCSI_Datastore_1 0 NFS_Datastore_1 0 NUC1 Local Datastore 8 vsanDatastore 1 |
Check Host’s NTP Server Settings and is the Service Running?
1 2 3 4 5 6 7 8 9 10 |
#Command Get-VMHost |Sort Name|Select Name, @{N=“NTPServer“;E={$_ |Get-VMHostNtpServer}}, @{N=“Service is Running?“;E={(Get-VmHostService -VMHost $_ |Where-Object {$_.key-eq “ntpd“}).Running}} #Output Example Name NTPServer Service is Running? ---- --------- -------------- esxi-01.vcallaway.com {time.vmware.com, time.windows.com} True esxi-02.vcallaway.com {time.vmware.com, time.microsoft.com} True esxi-03.vcallaway.com {time.microsoft.com, time.vmware.com} True esxi6-nuc1.vcallaway.com {time.vmware.com, time.windows.com} True |