PowerShell Looping Problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • starlight849
    New Member
    • Jun 2009
    • 82

    PowerShell Looping Problem

    Hi,

    I have two datatables that I'm attempting to loop through in a nested loop.
    I am never able to hit in the second loop when I'm using a second datatable. However, if I store the information in an array then I'm able to hit the second loop.
    I have ran tests to make sure the information is getting filled in both datatable so I know that isn't the problem.
    If I do seperate ForEach loops, I am able to loop through both tables successfully. However, at this point, for my purposes I need to nest them.
    Can anyone point me in the right direction?
    Here is my code
    Code:
     foreach ($iRow in $tableIns.Rows)
             { 
               Write-Host "<instance id=""$($iRow[2])"">";
             
                foreach ($rRow in $tableRev.rows)
                {
                Write-Host "hello";
                }
              }
Working...