Exchange – Add nested group recipients to parent resources

Do you have nested groups within Exchange resources such as distribution groups, shared mailboxes, rooms or equipment?

If you have, you have come to the right place. I have created a script that extracts all nested group members of a resource, and add it directly to the resource instead.

The script works in both on-premise and Exchange Online.

Before you can run the script, you need to have access to the following:

  • Access to on-premise and/or Office 365 environment as a administrator.
  • Have the AzureAD and Active Directory PowerShell module installed.

I created the script pretty fast for a customer, so the code isn’t beautiful or fast but it works as intended!


Experienced advanced operations engineer with a demonstrated history of working in the information technology and services industry. Skilled in Windows Server, Azure, Ethical Hacking, Office 365, Exchange, Jenkins, SCCM, Octopus Deploy and PowerShell to name a few. Strong engineering professional with a big passion for knowledge.


  1. Marcel

    Thanks for sharing your nice script!
    I have an on-prem exchange and would like explicitly add permissions to shared mailboxes to users that now have permissions through groups and nested groups.
    I Looked trough the script but I only see references to online shared mailboxes, not on-prem.
    Am i missing something here?
    Thanks for your reply

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.