Skip to content

Latest commit

 

History

History
26 lines (16 loc) · 1.32 KB

File metadata and controls

26 lines (16 loc) · 1.32 KB

Get-DistributionGroupMemberRecursive

PowerShell script used to recursively get a list of all members within a Distribution Group.

How to use

  1. Execute the function code.

  2. Call the function:

    Get-DistributionGroupMemberRecursive -Group "GroupName" | Export-csv -Path C:\test.csv -Delimiter ',' -Encoding 'UTF8'
    

Initializing the connection (Office 365)

Here is how to setup the connection with Office 365 Exchange servers through Powershell:

Set-ExecutionPolicy RemoteSigned    
$365Logon = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $365Logon -Authentication Basic -AllowRedirection

If you have large Distribution Groups, make sure to ajust the ResultSize parameter of Get-DistributionGroup:

Get-DistributionGroup -ResultSize Unlimited

Credits

Thanks to Mike Goldwin for his original code.
Thanks to JScott for column header labels code.