This is another way of doing the same.
Get-Datastore -Name (Get-Content luns.txt) -PipelineVariable ds |
Get-View -Id $ds.ExtensionData.VM -Property Name |
Select @{N='Datastore';E={$ds.Name}},
@{N='VM';E={$_.Name}}
} | ft -AutoSize
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference