vmware thin disk usage powercli

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:

(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:

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