Link to home
Start Free TrialLog in
Avatar of Garry Shape
Garry ShapeFlag for United States of America

asked on

Exchange Powershell - Importing CSV question

I have this code here that will let me specify mailboxes in one column and the users who can be granted access to that mailbox in the other column:

$Thelist = Import-csv “H:\MailboxAccess.csv”
ForEach($theobject in $thelist) {$theMBDN = (Get-Mailbox $theobject.themailbox).distinguishedname;
Add-ADPermission $thembDN -Extendedrights “Send As” -User $theobject.theuser;
Add-MailboxPermission $thembDN -Accessrights “FullAccess” -User $theobject.theuser 

Open in new window



But lets say I want 6 different users to have access to each other's mailboxes.
Instead of repeating each user's mailbox 6 times in the TheMailbox column, can I just put each person's mailboxname once in both columns, and have a script that loops through each one until each person has accesss to eachother's mailbox?

I attached the current CSV I'm working with so show you the redundancy I'm trying to eliminate.
ASKER CERTIFIED SOLUTION
Avatar of chrismerritt
chrismerritt

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Garry Shape

ASKER

Ty for solutions. Security Group wont work in this case but I'm sure it will help me when the time comes in the future.