PowerShell Genie

Shared mailbox inventory

Script 2 min read Windows PowerShell 5.1 and PowerShell 7

Documentation: Microsoft Learn

Passing -RecipientTypeDetails SharedMailbox to Get-EXOMailbox filters at the service rather than in the pipeline, and -ResultSize Unlimited keeps the full result set.

The script

1PS> Get-EXOMailbox -RecipientTypeDetails SharedMailbox -ResultSize Unlimited | Select-Object DisplayName,PrimarySmtpAddress

Script reader

Inspect before you run

Inspection only

Inspect the script below. It does not run in this browser.

Inspection only — no command has run.

    Show reference output
    1 DisplayName PrimarySmtpAddress RecipientTypeDetails
    2 -------------- ------------------- --------------------
    3 Adele Vance adelev@contoso.com UserMailbox
    4 Shared Support support@contoso.com SharedMailbox
    Inspect this example’s structure

    Read the command and its supplied arguments. This example requires real PowerShell or its module; this diagram does not execute it.

    Get-EXOMailbox -RecipientTypeDetails SharedMailbox -ResultSize Unlimited | Select-Object DisplayName,PrimarySmtpAddress
    1. Stage 1Get-EXOMailbox-RecipientTypeDetails -ResultSize
    2. Stage 2Select-ObjectPositional values or no named parameters

      How it works

      Passing -RecipientTypeDetails SharedMailbox to Get-EXOMailbox filters at the service rather than in the pipeline, and -ResultSize Unlimited keeps the full result set. The projection stays deliberately narrow at display name and primary address.

      Adapting it

      Pipe the results into Get-EXOMailboxPermission to attach who currently has access to each one, which turns a bare list into something an owner review can work through.

      Requirements

      ExchangeOnlineManagement module with a Connect-ExchangeOnline session.

      If the result is unexpected

      A shared mailbox is absent or listed as a user mailbox.

      Recipient type may not have changed yet, or the query uses the wrong organization or filter.

      1. Inspect RecipientTypeDetails for the mailbox and confirm the Exchange connection.

      Validate the result

      The inventory reflects the returned recipient type and identifies the organization.

      Keep the check reliable

      Treat conversion requests and confirmed recipient-type state as separate events.

      Primary documentation

      PowerShell objects and pipelines documentation

      Continue
      Genie guideShared mailbox inventory

      Passing -RecipientTypeDetails SharedMailbox to Get-EXOMailbox filters at the service rather than in the pipeline, and -ResultSize Unlimited keeps the full result set.