By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,952 Members | 1,619 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,952 IT Pros & Developers. It's quick & easy.

PowerShell Looping Problem

P: 82
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
Expand|Select|Wrap|Line Numbers
  1.  foreach ($iRow in $tableIns.Rows)
  2.          { 
  3.            Write-Host "<instance id=""$($iRow[2])"">";
  4.  
  5.             foreach ($rRow in $tableRev.rows)
  6.             {
  7.             Write-Host "hello";
  8.             }
  9.           }
  10.  
Jun 24 '15 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.