I want to ask a question about thin provisioning. `get-vm` commandlet can easly give us real space used by a vm totally. Assume that you have a virtual machine which has more than one thin disk. If we want to get more detail so as to calculate each disk real used space which powercli command does this? I do not prefer getting it by datastore browser for performance issues.
['https://serverfault.com/questions/560893', 'https://serverfault.com', 'https://serverfault.com/users/202314/']
The actual used disk space is retrievable without accessing the datastore separately, but you won't find the information in the disk object, but rather in the VM object. It is hidden in `$vm.ExtensionData.LayoutEx.File`, which contains information about all files related to the VM, not only the disk files. So the trick is to get the file information that relates to the queried disk.

If you only want the actual size, and nothing else, you can do it really quick like this:

```powershell
(get-vm vmname).ExtensionData.LayoutEx.File |
    Where-Object { $_.name -like '*-flat.vmdk' } |select Name,Size

Name                                                        Size
----                                                        ----
[Datastore1] vmname/vmname-flat.vmdk                 53895368934
[Datastore1] vmname/vmname_1-flat.vmdk               73348843320
[Datastore1] vmname/vmname_2-flat.vmdk              268902888606
[Datastore1] vmname/vmname_3-flat.vmdk               37724234832

```

If you want some more information about the disks:

```powershell
get-vm $vmname |Get-HardDisk |
    Select name,capacitygb,StorageFormat,@{name="UsedSpaceGB";e={ 
        $disk=$_;
        [math]::Round(($disk.Parent.ExtensionData.LayoutEx.File |
            Where-Object {
                $_.name -eq $disk.Filename.Replace(".","-flat.")
            }).Size/1GB,2) 
    }}

Name        CapacityGB    StorageFormat UsedSpaceGB
----        ----------    ------------- -----------
Hard disk 1         50 EagerZeroedThick       50,19
Hard disk 2        100             Thin       68,31
Hard disk 3        300             Thin      250,44
Hard disk 4         60             Thin       35,13

```
I found the following solution: 

```
(Get-VM -Name $YourVmName).Extensiondata.Guest.Disk

```

This command will give you all the disks of this vm with the provisioned size and the free space - with that you can calculate the real used size.

Source (with a complete script to list all disks): <http://www.vstrong.info/2014/03/28/vmware-powercli-script-to-list-thin-provisioned-virtual-disks-vmdk/>