Hi All,
I've got the script by Alan R.: Get-Datastore | Select Name, @{N="NumVM";E={@($_ | Get-VM).Count}} | Sort Name
Can anyone here please assist me in modifying script above to list additional VM information like:
VM name, VMDK size and Disk type (Thin/Thick).
Thanks.
How do you see the layout of the report, there are multiple VMs per datastore I assume?
I can place them all in one fields as one string.
Something like this
Get-Datastore |
Select Name,
@{N="NumVM";E={$script:vms = $_ | Get-VM; $script:vms.Count}},
@{N='VM';E={$script:vms.Name -join '|'}} |
Sort Name
Or you can go for one VM per line (this requires at least PS v4)
Get-Datastore -PipelineVariable ds | Get-VM |
Select @{N='Datastore';E={$ds.Name}},Name,
@{N="NumVMOnDatastore";E={$ds.ExtensionData.VM.Count}} |
Sort Name
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
How do you see the layout of the report, there are multiple VMs per datastore I assume?
I can place them all in one fields as one string.
Something like this
Get-Datastore |
Select Name,
@{N="NumVM";E={$script:vms = $_ | Get-VM; $script:vms.Count}},
@{N='VM';E={$script:vms.Name -join '|'}} |
Sort Name
Or you can go for one VM per line (this requires at least PS v4)
Get-Datastore -PipelineVariable ds | Get-VM |
Select @{N='Datastore';E={$ds.Name}},Name,
@{N="NumVMOnDatastore";E={$ds.ExtensionData.VM.Count}} |
Sort Name
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thanks for sharing such great script LucD , this one is more meaningful:
Get-Datastore | Select Name,
@{N="NumVM";E={$script:vms = $_ | Get-VM; $script:vms.Count}},
@{N='VM';E={$script:vms.Name -join '|'}} |
Sort Name
you are awesome and I learn something from the script above .