VMware Cloud Community
ANSUDHARSON
Contributor
Contributor

Provisioned, Used and Free Space information along with Thin / Thick provisioning information


Hi All,

I am currently using the below script to obtain VM Name, Disk Name, Disk format (Thick / Thin) for each disk for all the VMs in vCenter.

$report = @()

Get-VM | %{

     $vm= $_

    $_ | Get-HardDisk | %{

       $row = "" | Select VMname, HDname, HDformat

        $row.VMname = $vm.Name

       $row.HDname = $_.Name

        $row.HDformat = $_.StorageFormat

        $report += $row

   }

}

$report | Export-Csv "D:\Thin.csv" -NoTypeInformation -UseCulture

I want to have three more columns in this report to show the Provisioned space, Used Space and Free space corresponding to each hard disk of the VMs. Unable to find the right method. The ProvisionedSpaceGB and UsedSpaceGB in the Get-VM does not provide the provisioned and used space for each individual disk in the VM.

Can someone help me obtain the VM Name, Disk Name, Disk format (Thick / Thin), Provisioned Space, Used Space and Free Space for all the VMs in vCenter?

Thanks in advance.

Regards

Sudharson AN

0 Kudos
1 Reply
LucD
Leadership
Leadership

Afaik those values are only available on the datastore level, not on the virtualdisk level.


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

0 Kudos