Hello all,
I am fairly new to using PowerCLI and I am attempting to make a report that would show a datastore and all the VMs on it, the host they are on and the space used in GB and percent. Maybe in the future include Snapshot size and percent. This is what I have:
Get-VM | Select-Object @{N=”Datastore”;E={Get-Datastore -VM $_}},Name,VMHost,UsedSpaceGB | Export-CSV "\\DIR\test.csv" -NoTypeInformation
This outputs the data but all the datastores in just random order, then VMs, host and space. I would like to have the datastores listed together if possible. Overall any advice would be excellent!