I am querying my storage array to gather properties for initiators. Here is the code:
$global:Xtrem_HBA_list = @()
$global:Xtrem_HBA_list += Get-XtremInitiators -Properties name,port-address,ig-id
$Write-Host $global:Xtrem_HBA_list
This returns
name port-address ig-id
---- ------------ -----
comp-esxi-01_vmhba2 10:00:00:90:fa:53:f4:60 {c832425d03f84644be37ae3d4e49186c, comp-esxi-01, 1}
comp-esxi-01_vmhba3 10:00:00:90:fa:53:f4:61 {c832425d03f84644be37ae3d4e49186c, comp-esxi-01, 2}
My problem is that I need $global:Xtrem_HBA_list to contain the value from name, port-address and the second value from ig-id (comp-esxi-01). I am having difficulty extracting the value from the array within the array.
Thanks to Matt! I updated my code and got the exact output I was looking for.
$global:Xtrem_HBA_list = @()
$global:arr_HBAs = @()
$global:Xtrem_HBA_list += (Get-XtremInitiators).name
foreach ($i in $global:Xtrem_HBA_list){
$global:arr_HBAs += Get-XtremInitiator -InitiatorName $i | Select name,port-address,@{Name="ig-id";Expression={($_."ig-id")[1]}}
}