title: piping get-aduser output to set-aduser within a foreach loop
body: <p>I am trying to get a list of users where the telephone attrib is null and update the atrrib with a phone number, so far here is what I have:</p>
  
  <pre><code>$allen=gc "C:\0NIX\03SCRIPTS\TMP\jkirb\allen.txt"
  $phonenumber = "972-xxx-xxx"
  
  FOREACH ($user in $allen)
  {
  $nophone = get-aduser $user -pr *| where {$_.telephonenumber -eq $null} | select samaccountname |ft -HideTableHeaders
  Set-ADuser -identity "$nophone" -replace @{telephonenumber="$phonenumber"}
  </code></pre>
  
  <p>}</p>
  
  <p><strong>Which is erroring with this:</strong>
  Set-ADuser : Cannot find an object with identity: 'Microsoft.PowerShell.Commands.Internal.Format.FormatStartData Microsoft.PowerShell.Commands.Internal.Format.GroupStartData 
  Microsoft.PowerShell.Commands.Internal.Format.FormatEntryData Microsoft.PowerShell.Commands.Internal.Format.GroupEndData Microsoft.PowerShell.Commands.Internal.Format.FormatEndData' under: 
  'DC=bhcs,DC=pvt'.
  At line:7 char:1
  + Set-ADuser -identity "$nophone" -replace @{telephonenumber="$phonenumber"}
  + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      + CategoryInfo          : ObjectNotFound: (Microsoft.Power...t.FormatEndData:ADUser) [Set-ADUser], ADIdentityNotFoundException
      + FullyQualifiedErrorId : Cannot find an object with identity: 'Microsoft.PowerShell.Commands.Internal.Format.FormatStartData Microsoft.PowerShell.Commands.Internal.Format.GroupStartData Mic 
     rosoft.PowerShell.Commands.Internal.Format.FormatEntryData Microsoft.PowerShell.Commands.Internal.Format.GroupEndData Microsoft.PowerShell.Commands.Internal.Format.FormatEndData' under: 'DC=<br>
    bhcs,DC=pvt'.,Microsoft.ActiveDirectory.Management.Commands.SetADUser</p>