Script to list The Members of Nested Distribution Groups

Connect to Exchange Online PowerShell $UserCredential = Get-Credential$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirectionImport-PSSession $Session Get list of all distribution groups $groups = Get-DistributionGroup -ResultSize unlimited Loop through each group and get its members foreach ($group in $groups) {Write-Host "Group: $($group.Name)"$members = Get-DistributionGroupMember -Identity $group.Name -ResultSize unlimitedforeach ($member in $members)... Continue Reading →

Create a website or blog at WordPress.com

Up ↑