Quantcast
Viewing all articles
Browse latest Browse all 8820

Set Full Access to a mailbox with Powershell reading from CSV

HI,

I want to assign Full Control permissions to User2.....User5 mailboxes over User1 mailbox using powershell. The script reads users from a CSV in this format:

Mailbox,Users

User1,User2;User3;User4;User5

Where "Mailbox" is the mailbox I want other mailboxes can access it, and "Users" are  the users mailboxes that the Full Control permissions are being granted to on the other mailbox

My script contains this code:

ForEach-Object {
  $DelegatedUsers = $_.User -split ';'

  Add-MailboxPermission -Identity $_.Mailbox -AccessRights FullAccess -User $DelegatedUsers -InheritanceType All

#Add-MailboxPermission -Identity $_.Mailbox -AccessRights FullAccess -User  @{add= $DelegatedUsers} -InheritanceType All

}

But I receive this error: Cannot process argument transformation on parameter 'User'. Cannot convert the "System.Collections.ArrayList" value of
type "System.Collections.ArrayList" to type "Microsoft.Exchange.Configuration.Tasks.SecurityPrincipalIdParameter".

The problem resides in the manner I pass the values to "User"

Can somebody help me??

Thanks!!



Viewing all articles
Browse latest Browse all 8820

Trending Articles