title: Powershell loop Get-mailbox
body: <p>I'm writing a foreach loop script I've done this before but this script is giving me a problem.  It works when I manually enter the name but when I try and pull from a txt file I get errors. </p>
  
  <pre><code>$mailboxes = Get-Mailbox joerod
  
  foreach ($mailbox in $mailboxes) 
   { 
   $user = $mailbox.alias 
   Write-Host "Processing... $user" 
   $mailbox.EmailAddresses += [Microsoft.Exchange.Data.CustomProxyAddress] ("X500:/o=OrgName/ou=First Administrative Group/cn=Recipients/cn=$user") 
   Set-Mailbox -Identity $mailbox.alias -EmailAddresses $mailbox.EmailAddresses 
   } 
  </code></pre>