Link to home
Start Free TrialLog in
Avatar of Anthony K O365
Anthony K O365Flag for United States of America

asked on

How to get the Mailbox Permission of a user

I am trying to find ALL the mailboxes a particular user has access to. I'm using the following PS:
$allmbx = Get-Mailbox -ResultSize unlimited

Foreach ($mbx in $allmbx) {
Exchange 2016

      Get-MailboxPermission $_.identity -User ASmith | select identity, user, accessrights |epcsv D:\data\ASmithAccess.csv -notypeinfor
}

But I'm getting no results but I know the user has Full Access to a few mailboxes. I believe there may an issue in the 'Identity' switch. Please assist. Thanks!
Avatar of Saif Shaikh
Saif Shaikh
Flag of India image

List all mailboxes to which a particular user has Full Access permissions:

Get-Mailbox | Get-MailboxPermission -User xyz


List all shared/user/room/whatever mailboxes to which particular user has Full Access permissions:

Get-Mailbox -RecipientTypeDetails UserMailbox,SharedMailbox -ResultSize Unlimited | Get-MailboxPermission -User xyz

List all mailboxes to which members of a particular security group have access:

Get-Mailbox | Get-MailboxPermission -User xyz

List all mailboxes to which a user has Send As permissions:

Get-Mailbox | Get-RecipientPermission -Trustee xyz

List all user mailboxes to which members of a particular security group have Send As access:

Get-Mailbox -RecipientTypeDetails UserMailbox -ResultSize Unlimited | Get-RecipientPermission -Trustee xyz
Avatar of Anthony K O365

ASKER

Without creating a loop, this will cause the script to timeout with a limitations error. Please create while looping through all mailboxes first. thanks. This is for Exchange 2016 On-Prem

Thanks again!
$allmbx = Get-Mailbox -ResultSize unlimited

Foreach ($mbx in $allmbx) {
#Exchange 2016

      Get-MailboxPermission $mbx.identity -User ASmith | select identity, user, accessrights |epcsv D:\data\ASmithAccess.csv -notypeinformation
}

Open in new window


but it's actually the same  as what Saif said, but implemented in your script with a for loop.
Unfortunately, this only produced one mailbox, but the user i.e. 'ASmith' has access to many mailboxes. Also the accessRights column shows "Microsoft.Exchange.Management.RecipientTasks.MailboxRights [ ]"   whereas I as expecting to see 'Full Access'.  Any thoughts?
ASKER CERTIFIED SOLUTION
Avatar of footech
footech
Flag of United States of America image

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
Team,

You've all been very helpful! What a Team!!

Thanks!