Removing User from a list of user’s full mailbox access.

In case it’s a little convoluted. I have a user (admin1) who has full mailbox access to about 60 accounts (user1-60) in my Exchange online environment. I have a csv doc with the users listed (user1 etc).

$List = Import-Csv C:scriptsfmba.csv

#Loop through user in the CSV

ForEach ($User in $List)

{

#Remove Full Mailbox Permissions of people in list from -User

Remove-MailboxPermission -Identity $User -User admin1 -AccessRights FullAccess -InheritanceType All

}

I get the following error:

Cannot process argument transformation on parameter 'Identity'. Cannot convert value "@{User=user1}" to type

"Microsoft.Exchange.Configuration.Tasks.MailboxIdParameter". Error: "Cannot convert hashtable to an object of the following

type: Microsoft.Exchange.Configuration.Tasks.MailboxIdParameter. Hashtable-to-Object conversion is not supported in

restricted language mode or a Data section."

+ CategoryInfo : InvalidData: (:) [Remove-MailboxPermission], ParameterBindin...mationException

+ FullyQualifiedErrorId : ParameterArgumentTransformationError,Remove-MailboxPermission

+ PSComputerName : outlook.office365.com

Sorry if my post’s formatting is incorrect.

submitted by /u/thePipester
[link] [comments]

Leave a Reply