title: How to identify the last item from pipeline foreach-object cmdlet
body: <p>How do I determine if process is on the last item from a pipelined ForEach-Object cmdlet?</p>
  
  <p>Example:
  Let's say that I've previously defined connection for OLEDB to Access database to get the column definitions for each local table. I want list each of these columns with comma delimiter -- except when processing the LAST column. I want to omit the comma. </p>
  
  <pre><code>  ForEach($table in $Tables)
      { 
      $SchemaColumn = $Connection.GetSchema("Columns")
       $listarray = $schemaColumn |
       foreach-Object {
  
          If($_.Table_Name -eq $Table) { 
  
              IF "Last Item in Pipeline"   &lt;---------------------------what would go here?
                  {
                   "$($_.COLUMN_Name) $(Get-DataType($_.DATA_TYPE))"   &lt;---- no comma!
                  }
              ELSE   ## not the end of pipeline listing
                  {
                   "$($_.COLUMN_Name) $(Get-DataType($_.DATA_TYPE)), "  &lt;----yes comma!
                  }
          }
       } #end Foreach-Object
  </code></pre>