Are you using Exchange online?
You could save groups that you want checked into a source file:
Then save the script below into a .PS1 file:
$Data = @()
$Groups = import-csv c:/temp/groups.csv
foreach ($group in $groups){
$value = Get-DistributionGroup $group.Name | select DisplayName,@{Expression=" ";Label="ManagedBy";}
$temp = (Get-DistributionGroup $group.Name).ManagedBy
foreach ($element in $temp){
$value.ManagedBy = $element.tostring()
$temp2 = $value |select DisplayName,ManagedBy
$data+=$temp2
}
}$data | export-csv c:/temp/Owner.csv -NoTypeInformation
Run this PS1 file in Exchange online PowerShell. You will could get the output like below:
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.