title: Powershell. Loop through all AD users/mailboxes and run comand on all users/mailboxes
body: <p>What I need to do is grant one user read access to the whole business exchange calendars.
  So I’ll need to loop through or create an array of all users using powershell in Exchange.
  What’s the best way? Something like the below, but this may be completely wrong. </p>
  
  <p>Please advise! I need to run this from exchange server as the command in the loop is specific to exchange. </p>
  
  <p>$Users = 
  <strong>Get-ADGroupMember -Identity $name |
  Where-Object {$_.distinguishedName -like '<em>OU=Depots</em>'}</strong></p>
  
  <p>foreach ($user in $users) 
  {<br>
      Add-MailboxFolderPermission -Identity $user:\ -User USERABC-AccessRights Reviewer
      Add-MailboxFolderPermission -Identity $user:\Calendar -User USERABC -AccessRights Reviewer</p>
  
  <p>}</p>