What syntax would i use to convert DatastoreIdList to datastore? i want to report the which datastore the vm has files on
get-vm cbsprtg01 | select Name, Datastore*
Name DatastoreIdList
---- ---------------
cbsprtg01 {Datastore-datastore-15069, Datastore-datastore-260539}
Try like this
Get-VM | select Name,
@{N='Datastore';E={(Get-View -Id $_.DatastoreIdList -Property Name).Name -join ','}}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Try like this
Get-VM | select Name,
@{N='Datastore';E={(Get-View -Id $_.DatastoreIdList -Property Name).Name -join ','}}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
What output do you want?
Get-VM $vm | select Name, @{N="Datastore";E={Get-Datastore -vm $_}
That will get you the same info without having to convert.
Get-VM $vm | select Name, @{N="Datastore";E={Get-Datastore -vm $_} }
Note the command above needs the extra "}" at the end.