Community maintenance is complete. Thank you for your patience!

Microsoft Virtualization Discussions

Problem adding interfaces to vif using new-nanetvif

BWINSTANLEY74

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

1 REPLY 1

vinith

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 ?

Announcements
NetApp on Discord Image

We're on Discord, are you?

Live Chat, Watch Parties, and More!

Explore Banner

Meet Explore, NetApp’s digital sales platform

Engage digitally throughout the sales process, from product discovery to configuration, and handle all your post-purchase needs.

NetApp Insights to Action
I2A Banner
Public