Distribution Groups nested – get list only groups

Recently, we described how to obtain a list of all mailboxes in the group that has nested distribution groups.

Unfortunately, using this method, you can not get a list of groups in a distribution group, only users (mailboxes).

To obtain this list, you need to write more or less complicated powershell script or use the additive Quest Powershell Module for Active Directory.

 

After installation of Quest Module, run powershell console and run:

add-PSSnapin quest.activeroles.admanagement

Continue reading

Get distribution group all members – nested

How can we get a list of mailboxes belonging to a distribution group?
In a simple way, by using the EMC console and check who is a member of a group, or by using powershell EMS console and use the command:

Get-DistributionGroupMember Test_Group

 

In this way we get a list of objects in the group, both mailboxes, contacts, and other groups.

And here there is a problem, because if the distribution group includes the next distribution group, and this again next etc, how can we get a list of all people who receive an email after sending a message to a distribution group?

Unfortunately, using only the Get-DistributionGroupMember we won’t get such information.

This command returns only the objects directly in a group, without nesting.

In this case, we have to use PowerShell commands for Active Directory available.

To do this run EMS console and import the Active Directory module command as follows:

import-module ActiveDirectory

Continue reading

Search-Mailbox delete emails sent to Distribution Group

 

When someone will send email to wrong distribution group you can easly delete this email using Search-Mailbox CMDlet.

All you need it’s to get distribution group members and run for each of them search-mailbox.

Below you can find example how to remove email sent to distribution group Important_DL     with subject Confidential Report.

Get-DistributiongroupMember Important_DL | Search-Mailbox -SearchQuery subject:"Confidential Report" -DeleteContent -Force:$TRUE

 

Above command will delete email with subject Confidential Report from users mailboxes which are members of Important_DL distribution group.

You can also use others attribute to define email properties to delete.

Below you can find more properties which you can use:

Continue reading