HI
Thanks for the Reply,
my requirement is to get the hard disk usage on the hard disk front.
get-vm DRaaS-vCenter| Get-VMGuest -PipelineVariable guest |
where{$_.Disks -ne $null} |
ForEach-Object -Process {
$_.Disks | ForEach-Object -Process {
New-Object PSObject -Property ([ordered]@{ Server = $guest.VM.Name
Path = $_.Path
CapacityGB = [math]::round($_.CapacityGB)
FreeSpaceGB = [math]::round($_.FreeSpaceGB)
Percent = [int]($_.FreeSpaceGB/$_.CapacityGB * 100)
})}}
Server : DRaaS-vCenter
Path : C:\
CapacityGB : 80
FreeSpaceGB : 38
Percent : 47
(get-vm DRaaS-vCenter).extensiondata.layoutex.file |?{$_.name -match ".vmdk"}
Key : 4
Name : [ADAMA-STD-G200-DS07:02] DRaaS-vCenter/DRaaS-vCenter.vmdk
Type : diskDescriptor
Size : 0
UniqueSize : 0
BackingObjectId :
Accessible : True
Key : 5
Name : [ADAMA-STD-G200-DS07:02] DRaaS-vCenter/DRaaS-vCenter-flat.vmdk
Type : diskExtent
Size : 53520367616
UniqueSize : 53520367616
BackingObjectId :
Accessible : True
PS C:\> 53520367616/1024/1024/1024
49.8447265625
here the out put of disk size with difference of 8 GB. i ran this on my test env, when i run the same on prod many servers report with 0 or lesser than what it shows on the guest level.