Hello,
At some point LucD posted the following answer in another thread http://communities.vmware.com/thread/293395
Get-Datacenter | Get-VM | %{$vm = $_Get-Datastore -VM $vm | %{$vm.Name + "-" + $_.Name} } | ft -AutoSize
But on my end, I can not make it work I get the following error:
You must provide a value expression on the right-hand side of the '-' operator.
At line:1 char:41
+ Get-Datacenter | Get-VM | %{$vm = $_Get- <<<< Datastore -VM $vm | %{$vm.Name + "-" + $_.Name} } | ft -AutoSize
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : ExpectedValueExpression
Thanks for your help,
There is a semicolon missing. It should be:
Get-Datacenter | Get-VM | %{$vm = $_ ; Get-Datastore -VM $vm | %{$vm.Name + "-" + $_.Name} } | ft -AutoSize
There is a semicolon missing. It should be:
Get-Datacenter | Get-VM | %{$vm = $_ ; Get-Datastore -VM $vm | %{$vm.Name + "-" + $_.Name} } | ft -AutoSize
Thank you man, you guys rock.