Here is a portion of the code.
$importData = @()
for ($i = 0; $i -lt $importData1.Count; $i++) {
Write-Host "Debug: Variable `$i is $i"
switch -Regex ($importData1.Vlan[$i]) {
{ ($_ -match '2') -or ($_ -match '1') } {
switch -Regex ($importData1.IP[$i]) {
'^d{1,3}.d{1,3}$' {
# For Jungee Mixer/Screen
$a, $b = $($importData1.Device[$i]).Split('/')
$c, $d = $($importData1.IP[$i]).Split('/')
$importData += @{Device = "$c"; IP = "$a" }
$importData += @{Device = "$d"; IP = "$b" }
}
.....
Here is a portion of the first array:
Device VLAN IP
------ ----- --
Laundry Controller (WAN) 2.00 10.20x.yy.zz
VLAN 20 (Spare Port) 2.00
Accudate Food Labeler (PAR) 1.00 zz.00
My first issue is that the “$importData1.Vlan[$i]” does not give me element 2’s VLAN entry. I have to use $importData1[$i] which will give me the second element but will not give me the VLAN entry.
I’m sure that there is a simple solution that I must be overlooking.
My second issue i’m sure is caused my the first. Nothing is being added to the second array.
I am a loss as to what to try.
user25331011 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.