Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Exchange Powershell : Loop through all users/Mailboxes and run an exchange command on the mailbox.

$
0
0

Hi all,

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.

Please advise! I need to run this from exchange server as the command in the loop is specific to exchange.


$Users =
**Get-ADGroupMember -Identity $name |
Where-Object {$_.distinguishedName -like '*OU=Depots*'}**
 
foreach ($user in $users)

 Add-MailboxFolderPermission -Identity $user:\ -User USERABC-AccessRights Reviewer
 Add-MailboxFolderPermission -Identity $user:\Calendar -User USERABC -AccessRights Reviewer

 }


Viewing all articles
Browse latest Browse all 21975

Latest Images

Trending Articles



Latest Images