Hi,
I want to add a column for the total number of VMs per folder, I've added this:
@{N="Folder";E={$_.Name}},@{N="Number of VM's";E={($_|Get-VM|Measure-Object).Count}},
--------------
Get-VM | Group-Object -Property {$_.Folder.Id} |
Select @{N="Folder";E={
$folder = $_.Group[0].Folder
$path = $folder.Name
while($folder.Parent){
$folder = $folder.Parent
$path = $folder.Name + "/" + $path
}
$path
}},
@{N="Folder";E={$_.Name}},@{N="Number of VM's";E={($_|Get-VM|Measure-Object).Count}},
@{N="NumCPU";E={$_.Group | Measure-Object -Property NumCpu -Sum | Select -ExpandProperty Sum}},
@{N="MemoryGB";E={$_.Group | Measure-Object -Property MemoryGB -Sum | Select -ExpandProperty Sum}} |
Export-Csv C:\report.csv -NoTypeInformation -use
It fails to run, what am I missing ?