I am currently tryng to produce a list of all shared mailboxes on the system including last accessed time and size of each mailbox. A lot of the “shared mailboxes” have been created as a normal mailbox with access granted to specific users to the mailbox. What i’m trying to achieve is: Find all shared mailboxes on Exchange (mailboxes with one or more users using this mailbox), find out when it was last accessed and the size of the mailbox.

Currently this is the script I am using but I’m not even getting anything results.
Get-Mailbox -RecipientTypeDetails SharedMailbox | Get-MailboxPermission | Select Identity,User,@{Name=‘Access Rights’;Expression={[string]::join(', ', $_.AccessRights)}} | Export-Csv C:\temp\sharedmailboxpermission.csv –NoTypeInformation
Can anyone please help?

5 Spice ups

First thing you might want to do is change all the mailboxes to a shared mailbox. Use this command:

Set-Mailbox name@domain.com -Type shared

If they are not share mailboxes, you will not see them with the command you are using.

Welcome to the wonderful world of PowerShell and to the Spiceworks forum. This forum provides advice and guidance, but we do not operate a script writing service. The approach is that we can help you but we expect you to be doing some work too! What have you tried so far? Feel free to share your code and we’ll look over it

If you post code, please use the ‘Insert Code’ button. Please and thank you!

PLEASE READ BEFORE POSTING! Read if you’re new to the PowerShell forum!

Scripting.png

To be clear, a Shared Mailbox is a specific type of mailbox. You can convert regular user mailboxes to Shared and back again.

You can also grant permissions on mailboxes (regular or shared) to other users.

if you only want “Shared Mailboxes” the code you posted is the correct approach and just needs fine tuning. On the other hand, if you want all mailboxes accessible by someone other than the owner you will need something more complex.

Can you please clarify?

As others have mentioned, you will need to include all mailbox types if your code (so remove the -RecipientTypeDetails parameter or adjust it to include other mailboxes). And, with your definition of “shared”, you might also want to include folder-level permissions. Some sample scripts I wrote a while back can help you with that:

Full Access permissions inventory: https://gallery.technet.microsoft.com/Office-365-Mailbox-c2adf0db?redir=0

Folder permissions inventory: https://gallery.technet.microsoft.com/Office-365-Mailbox-Folder-17251cab

Have you tried the suggestions provided above and get the right results?

I also find a simialr case here for your reference:

Powershell Script to get mailbox details for those having full mailbox/Send-As access on all/Specific shared mailboxes.