Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Format into hashtable

$
0
0

Hi I'm trying to create a table containing vm name and the datastorecluster they are contained within, no matter what I try I cant seem to create the table I can list the object as follows:-

 

$vmlist = Get-Content 'C:\vmlist\vm2.txt'

foreach ($vm in $vmlist){

get-vm $vm | select name

get-vm $vm | get-datastorecluster

}

But as soon as I try to create a hash table from the above it just doesn't work no matter which approach I take, can anyone help? 

Thanks


Viewing all articles
Browse latest Browse all 6937

Trending Articles