Home » PowerShell » How to Get Distribution Groups using PowerShell

How to Get Distribution Groups using PowerShell

To get the distribution groups in your organization using PowerShell, use the `Get-Distribution` command. This command is used to view existing distribution groups or mail-enabled security groups.

Here, is the PowerShell command to get distribution groups in your organization:

Get-DistributionGroup

The Get-DistributionGroup cmdlet in PowerShell is used to list all distribution groups and mail-security groups, provides detailed information about the distribution group, and -Anr parameter to search for objects with an attribute that matches the string.

In this article, we will discuss how to get distribution groups in your organization using the PowerShell command Get-DistributionGroup.

How to Get Distribution Groups Using PowerShell

Use the PowerShell command Get-DistributionGroup to get all distribution groups and mail-security groups in your organization.

Get-DistributionGroup

This PowerShell command returns a summary list of all distribution groups in your organization.

How to Get Detailed Information About Distribution Group

To get detailed information about the distribution group, use the Get-DistributionGroup cmdlet along with the Identity parameter to specify the distribution group name.

Get-DistributionGroup -Identity "SalesTeam" | Format-List

In the above PowerShell script, the Get-DistributionGroup command gets detailed information about the distribution group named SalesTeam.

Cool Tip: How to get distribution group members in PowerShell!

How to Get Distribution Group based on Filter criteria

To get the distribution group based on the search criteria, use the Get-DistributionGroup cmdlet with the -Anr parameter.

Get-DistributionGroup -Anr sales | Format-Table Name, ManagedBy -Auto

In the above PowerShell script, the Get-DistributionGroup command returns all distribution groups and mail-enabled security group whose names contains the string “sales” and displays their group owner.

Conclusion

I hope the above article on how to get distribution group members in your organization using the PowerShell Get-DistributionGroup cmdlet is helpful to you.

You can find more topics about PowerShell Active Directory commands and PowerShell basics on the ShellGeek home page.