Exchange Online PowerShell to get Distribution Group Manager Name
Hey, we need to get distribution group manager name.
Code 1
Get-DistributionGroup -Identity 'PowerShell
Support' | Select -Property ManagedBy
Returns:
Array of Objects
ManagedBy
---------
{Venkatesan, C. (Chendrayan)}
We need to do more processing with display name. Remove {} and get only the display name.
Hold on- this is an array collection. What are you trying to do? What happens if you have more than one manager for a Distribution group?
We need to get Manager email ID.
Code 2
(Get-DistributionGroup -Identity 'PowerShell
Support').ManagedBy
Returns
Venkatesan, C. (Chendrayan)
Code 3
(Get-DistributionGroup -Identity 'PowerShell
Support').ManagedBy | %{Get-MailBox -Identity $_}
Code 4
(Get-DistributionGroup -Identity 'PowerShell
Support').ManagedBy | %{Get-Mailbox -Identity $_ | Select -Property PrimarySMTPAddress}
Enjoy PowerShell :)