r/PowerShell • • 4d ago

Script Sharing I built a free WinForms GUI to see which mailboxes a user can access in Exchange Online (reverse lookup + grant/copy/remove)

Hi r/PowerShell,

one thing that always annoyed me as an M365 admin: the Exchange Admin Center only shows permissions per mailbox. There is no quick way to answer "Which mailboxes, calendars and room mailboxes does user X have access to?" – especially during onboarding/offboarding or when someone changes departments.

So I built MailboxAccess, a PowerShell/WinForms tool on top of the EXO v3 module.

What it does

  • Reverse lookup: enter a user → see all mailboxes they have FullAccess, SendAs, SendOnBehalf or folder/calendar permissions on
  • Room mailboxes: includes calendar permissions and booking delegates
  • Grant / copy / remove: add rights, copy all rights from one user to another (onboarding), or remove everything (offboarding)
  • Mailbox view: who has access to a specific mailbox
  • Tenant report: overview of all non-default permissions
  • Fast: results come from a local cache (seconds instead of minutes). The cache can be refreshed incrementally via the Unified Audit Log (delta update), so you don't have to rebuild it every time
  • Runs locally, no server, no cloud service, data stays in `%LOCALAPPDATA%`

Requirements

  • Windows PowerShell 5.1
  • `ExchangeOnlineManagement` module
  • Exchange admin rights (plus "View-Only Audit Logs" for the delta update)

Download

GitHub: https://github.com/RazeAttack/MailboxExchangeGUI

You can run the `.ps1` directly or use the EXE from the releases (built via GitHub Actions, SHA256 checksums included). The EXE is a ps2exe build and not code-signed yet (code signing via SignPath is in progress), so Defender/SmartScreen may complain – if you prefer, just run the script.

MIT licensed, free. Feedback, issues and PRs are very welcome – especially on performance in larger tenants (I've tested it with ~350 mailboxes).

Screenshots are in the README (tenant data redacted).

58 Upvotes

18 comments sorted by

4

u/dragery 4d ago

Was hoping for some magic that didn't require caching all mailboxes permissions. Darn.

3

u/New-Aside7807 4d ago

Same here, I really wanted that too :) Unfortunately Exchange Online has no reverse index for most permission types:

  • SendAs – this one actually works server-side: `Get-EXORecipientPermission -Trustee user@domain`
  • SendOnBehalf – also possible with a filter: `Get-EXOMailbox -Filter "GrantSendOnBehalfTo -eq '<DN of user>'"`
  • FullAccess and folder/calendar permissions – no trustee filter exists. `Get-MailboxPermission -User` still iterates every mailbox client-side, same for `Get-MailboxFolderPermission`. Graph doesn't expose these at all.

So for FullAccess + calendars you have to touch every mailbox once. That's why the tool builds the cache once and then only refreshes mailboxes that actually changed, based on the Unified Audit Log (Add/Remove-MailboxPermission, *-MailboxFolderPermission, Set-CalendarProcessing). After the initial build, a delta update usually takes seconds instead of minutes.

If anyone knows a server-side way for FullAccess, I'd genuinely love to hear it.

2

u/sleasayngot 1d ago

yeah same, there really is no getting around pulling everything first unfortunately

3

u/journeypiggyman 2d ago

Why does OP sound like AI hmmm

1

u/New-Aside7807 7h ago

English isn't my first language (I'm from Germany), so I used an AI tool to polish the post and README. The tool itself is something I use daily at work, and the code is on GitHub if you want to check it.

2

u/Randalldeflagg 2d ago

Have you considered setting up an entra app and granting it to access to the graph apis? Then it could just run continuously in the background as a service that you can launch and query from a PAM.

That has always been one of my annoyance with 365. Tons of data and meterics are available to you if you know where to look. We currently pay for Admin Droid to do a lot of our heavy lifting for reporting. But the new powers in charge don't see the benefits of it. So Ive been working on replacing the reporting we currently get.

1

u/New-Aside7807 7h ago

Good point, thanks. For reporting (tenant stats, usage, licenses) an app registration with Graph application permissions is definitely the cleaner approach, and it's on my list. For this tool the main job is managing mailbox permissions (Full Access, Send As, Send on Behalf, calendar and folder permissions), and that still lives in Exchange Online PowerShell, because Graph doesn't cover most of it. EXO V3 does support app-only auth with a certificate though, so running it unattended from a PAM-launched context is possible. Curious how far you got replacing Admin Droid, which reports were the hardest?

1

u/7amitsingh7 1d ago

This solves a common pain point for exchange admins. especially useful during onboarding and offboarding when tracking mailbox permissions can become time-consuming.

1

u/New-Aside7807 7h ago

Thanks! Offboarding was exactly why I built it.

1

u/omglazrgunpewpew 1d ago

Possible edge case for larger tenants. In Get-AuditChangedMailboxes, the ResultIndex >= ResultCount check runs before the 50K record guard. If both are true on the same page, the loop exits with Truncated still false, and Update-CacheDelta advances LastDelta. Would it make sense to split and retry the time window whenever it hits the cap, then advance LastDelta once the whole window has been processed? Spotted this in the source, haven't repro'd against a tenant.

-3

u/dabbuz 4d ago

why is psexe in there ????, this is like 20 year old method, good effort but seems like junk code

4

u/New-Aside7807 4d ago

Fair point – ps2exe isn't pretty and it's exactly what triggers Defender's ML heuristics. The EXE is just an optional convenience wrapper so helpdesk colleagues can start it with a double-click; the actual tool is the plain .ps1 in the repo, and that's what I'd recommend running.

If you have a better approach for shipping a WinForms PowerShell tool to non-PowerShell people (signed launcher, PSGallery script, something else), I'm open to suggestions – happy to drop ps2exe.

3

u/mingk 3d ago

Don’t listen to the naysayers. Gotta treat the Service Desk just like you would their weakest link.

2

u/New-Aside7807 3d ago

Thanks! That's pretty much the reasoning – the GUI is mostly about guard rails (preview, confirmation, audit CSV) for the destructive parts.

2

u/krzydoug 2d ago

I use Merge-Script from the powershell protools module written by Adam Driscoll

0

u/spikeyfreak 3d ago

If you have a better approach for shipping a WinForms PowerShell tool

Ditch the GUI, turn it into a module, show them how to load the module, and run the function(s) in the console. The idea that you have to create a GUI for a helpdesk person is crazy.

No one that is a productive IT person is incapable of running a ps1.

2

u/New-Aside7807 3d ago

You're right about the module part – that's where this is heading. Next version splits it up:

  • MailboxAccess module (PSGallery) with the actual functions: `Get-MailboxAccess -User`, `Grant-/Remove-/Copy-MailboxAccess`, `Update-MailboxAccessCache -Delta/-Full`, `Export-MailboxAccessReport`. Pipeline-friendly, -WhatIf/-Confirm, usable in scheduled tasks or runbooks.
  • GUI as an optional front-end on top of the same module (`Start-MailboxAccessGui`), no separate logic.
  • ps2exe goes away.

I'd still keep the GUI though – not because helpdesk can't run a ps1, but because for offboarding/copying rights a preview with explicit confirmation and a CSV audit trail prevents mistakes. Console users get the same safety via -WhatIf.