Hi All,
I have powershell that lists VM name and its subsequent vmdk files along with datastore name. I need to add Get-VM’s property UsedSpaceGb in the report.
[pre]
$VMsAdv = Get-VM | Sort-Object Name | % { Get-View $_.ID }
$myCol = @()
ForEach ($VMAdv in $VMsAdv)
{
ForEach ($Disk in $VMAdv.Layout.Disk)
{
$myObj = “” | Select-Object Name, Disk
$myObj.Name = $VMAdv.Name
$myObj.Disk = $Disk.DiskFile[0]
$myCol += $myObj
}
}
$myCol
[/pre]
At present the report looks like below
Name Disk
VMname [Datastorename] VMName_1.vmdk
I would like it to be with VMName, Datastorename, Vmdk file name and Storage used by VMdk file in the report. Can anybody help me ?