Microsoft Virtualization Discussions

NetApp.Ontapi.Filer.Lun.InitiatorInfo[] instead of initiators displayed

dlmaldonado
3,415 Views

Having trouble calling value of initiators in a script. I seem to only be able to produce "NetApp.Ontapi.Filer.Lun.InitiatorInfo[]" as the value.

If I enter the same commands into the shell, I received the correct results.

For example:

In the shell --

> $myigroup = get-naigroup VMWare
> $myigroup.Initiators

InitiatorName
-------------
21:01:00:b0:83:83:de:c5
21:01:00:b0:83:83:fg:c9

But if I use the same in a script and execute, the value of $myigroup.Initiators becomes "NetApp.Ontapi.Filer.Lun.InitiatorInfo[]".

Any ideas why?

1 ACCEPTED SOLUTION

dlmaldonado
3,415 Views

Figured it out. The value of $myigroup.Initiators is an array. I needed to change it to a string in order to use it as "one value".


To do that I used the string join method:


>([string]::join(",",($myigroup.Initiators)))

Which resulted in:


21:01:00:b0:83:83:de:c5,21:01:00:b0:83:83:fg:c9


Which I could then use as a value in my Export-CSV file.

View solution in original post

1 REPLY 1

dlmaldonado
3,416 Views

Figured it out. The value of $myigroup.Initiators is an array. I needed to change it to a string in order to use it as "one value".


To do that I used the string join method:


>([string]::join(",",($myigroup.Initiators)))

Which resulted in:


21:01:00:b0:83:83:de:c5,21:01:00:b0:83:83:fg:c9


Which I could then use as a value in my Export-CSV file.

Public