Mark Jones wrote:
Driver,
You can also use a CSV spreadsheet with headers and colums if you need more data.
IE
hosts.csv
hostname,ip
blah.blah.com,10.10.10.10
Then you can do
$data = import-csv hosts.csv
you can reference the members like so:
foreach ($var in $data)
{ get-vmhost $data.hostname or get-vmhost $data.ip
}
You basically can reference the column headers in your loop
I figured I would play for a few minutes... When I create the csv like this:
hosts.csv
inside there is......
host,ip
host1,1.2.3.4
host2,2.3.4.5
it errors stating "argument is null"
If there is only
host,ip
host1,1.2.3.4
it works fine. I assumed I could add multiple hosts but it does not appear to work..