Jan 15 2019 08:30 PM
Hi,
I'm quite new to powershell and am just wondering if there's a way to get all of the shared mailboxes in Office 365 that haven't got any delegates on them?
Thanks
Salim
Jan 15 2019 09:26 PM
Jan 15 2019 11:13 PM
Delegates can have a different meaning, are you referring to granting mailbox-level access (Full access) or folder-level access? For both of these scenarios you can easily use PowerShell to get a list of "undelegated" mailboxes, but the cmdlets you will have to use are a bit different.
Jan 16 2019 01:33 PM
@adam deltinger wrote:
Hi!
I’m not able to write anything right now but I found maybe a little workaround script in this post here:
https://social.technet.microsoft.com/Forums/en-US/c4372940-51c6-4c72-8414-424793fd9ac0/list-shared-m...
Adam
Hi Adam,
Thanks for that I'll give it a try!
Jan 16 2019 01:34 PM
Jan 17 2019 07:05 AM
Hm, for this scenario perhaps a better way will be to do a message trace instead? I mean you might have shared mailboxes that nobody can access (no permissions granted), however they might still be receiving messages, isn't thing something you want to account for?
Jan 17 2019 12:39 PM
Jan 19 2019 12:06 AM
Well, here's a quick sample of what you can do with PowerShell:
Get-Mailbox -RecipientTypeDetails SharedMailbox |select PrimarySmtpAddress,@{n="FullAccess";e={ (Get-MailboxPermission $_.PrimarySmtpAddress | ? {($_.User -ne "NT AUTHORITY\SELF") -and ($_.IsInherited -ne $true) -and ($_.AccessRights -match "FullAccess") -and -not ($_.User -like "S-1-5*")}).User -join "," }} |? {!$_.FullAccess}
It's a one-liner, so a bit ugly, but should get the job done. Do note that it will take a long time to run if you have a large number of mailboxes. Also it doesn't cover any folder-level permissions, if you want these included best go with a full-blown script. I have few samples posted on the TechNet Gallery, you can easily adapt them.
Aug 28 2019 07:07 AM
@Vasil Michev I can't get your command above to work?
It returns the PrimarySMTPAddress for accounts where there are real users with FullAccess permission
Oct 31 2019 11:22 AM
I don't think that would return anything that is null.
Mar 27 2020 09:40 AM
Excellent, thanks for sharing! @Vasil Michev