title: Extract data from System.Data.DataRow in powershell
body: <p>I have a powershell script that executes an sql command and returns a list of ID numbers. </p>
  
  <p>When I iterate through the list, this is what it returns. </p>
  
  <pre><code>System.Data.DataRow
  System.Data.DataRow
  System.Data.DataRow
  System.Data.DataRow
  System.Data.DataRow
  System.Data.DataRow
  </code></pre>
  
  <p>I tried adding <code>Out-String</code> to my list, </p>
  
  <pre><code>$q_result = $db.ExecuteWithResults($int_cmd2)
  $table = $q_result.Tables[0] | Out-String
  
  foreach ($user_info in $table)
  {
      write-host $user_info 
  }
  </code></pre>
  
  <p>but that returns a poorly formatted list of numbers, everything is tabbed to the very right. see below.</p>
  
  <pre><code>                                                                                                      GroupID
                                                                                                        -------------
                                                                                                                  381
                                                                                                                  382
                                                                                                                  383
                                                                                                                  384
                                                                                                                  385
                                                                                                                  386
  </code></pre>
  
  <p>I tried using, <code>$user_info.Item[0]</code> in the loop,  but that returns nothing. </p>
  
  <p>How can I extract just the numbers from the list?. </p>