Subscribe

Problem adding interfaces to vif using new-nanetvif

Hi,

I am trying to create a new vif with the new-nanetvif command.  I have an execl spreadsheet like so:

Interface Name(A)          Interfaces(B)             Type(C)     LB(D)

ifgrp-nas                        e0a e0b                    lacp            ip

ifgrp-iscsi                      e1a e1b                     lacp           ip

I am reading each item on a row into a variable and running the new-nanetvif command.  The problem I have is that the interfaces (e0a, e0b) aren't not being configued on the vif.  It seems that the command is wanting a string array; but when I provide an array it throws an error. 

Sample code below

# Get ifgrp worksheet and process

$ifgrp=$ExcelWorkBook.sheets.item(6)

$intRowMax=($ifgrp.UsedRange.Rows).count

  for($intRow=2;$intRow -le $IntRowMax;$IntRow++)

{

    new-nanetvif  $ifgrp.cells.item(2,"A").value2  $ifgrp.cells.item(2,"B").value2  $ifgrp.cells.item(2,"C").value2  $ifgrp.cells.item(2,"D").value2

}

Any help much appreciated!

Cheers

Re: Problem adding interfaces to vif using new-nanetvif

Hey Barry - Can you convert the .xls to a .csv file and try importing the csv using "Import-csv" cmdlet and then try passsing the imported objects to the for each loop ?