I have a script which is working fine for the setup of my virtual switches using the updatevirtualswitch method. (thanks to LucD, see here : http://communities.vmware.com/message/1556669#1556669)
I would like now to go a step further and feed my script with variables coming from a .csv file.
This is working fine for everything, except for the vmnic definition. Problem description:
Excerpt from my .csv file :
lannics;dmznic1;dmznic2;dmznic3;storagenics;vmotionnics;
@("vmnic0");@("vmnic1", "vmnic2"); ; ; ; ;
Then I import the parameters from the csv file, example:
$lannics = $parameterfile.dmznic1
Now, if I check what's in $dmznic1, I have the correct : @("vmnic1", "vmnic2")
But it seems to be a string, not a real array. Therefore, I can't pass it to my updatevirtualswitch function :
function standardvswitch {
param ($esx, $vs, [string[]]$dmznic1)
....
$ns.UpdateVirtualSwitch( $vs, $vsSpec)
}
So the question is: in which way could I enter the informations in my .csv file, so that it can be used for a vmnic definition compatible with the UpdateVirtualSwitch method?
Thanks for your help or ideas!