tdubb123
Expert
Expert

datatore VM report

how can I get a report on what vms are on what datastores ?

I have this working but the format is not what I am looking for

Get-Content .\luns.txt | % { Get-vm -Datastore $_ | select name, @{N="Datastore";E={[string]::Join(',',(get-datastore -id $_.datastoreIdlist | select -ExpandProperty Name))}}} | Export-Csv vms_in_datastore_report.csv




I want to have the output like

datastorename1  VM1

                            VM2

datastorename2  VM3

                              VM4