I want to calculate the total disk capacity of an ESXi host (not the VMs). I want to check the total disk capacity, free and used space of ESXi host via PowerShell.
I am calculating CPU and RAM usage by using the below command:
(Get-VMHost $server | Get-Stat -Stat "mem.usage.average" -IntervalMins 10 | Measure-Object Value -Average).Average
Please suggest a way to calculate disk usage. I know about disk.usage.average parameter but I don't want this, I want space calculation in GB/MB.
Use the Get-Datastore
cmdlet.
PS /Users/philip> Get-Datastore
Name FreeSpaceGB CapacityGB
---- ----------- ----------
Synology 632.840 7,317.147
SSD01 111.347 476.750
PS /Users/philip> Get-Datastore -Name synology
Name FreeSpaceGB CapacityGB
---- ----------- ----------
Synology 632.840 7,317.147
This is only for getting information about the datastores on which VM's are located, not the actual installation of esxi itself.