Trying to create PowerShell for Exchange Online ( running v3)
Need to add Owners (Managed By) to many DLs.
This would be a combination of multiple users and multiple distribution groups hence the need for CSV.
I have tried the following but it ends up replacing the last user on the list as the owner of the entire list of distribution groups :
$GroupList = Import-CSV C:\temp\ManagedBy.csv
ForEach ($group in $GroupList)
{
ForEach ($user in $GroupList)
{
}
Set-DistributionGroup -BypassSecurityGroupManagerCheck -Identity $group.GroupName -managedby $user.ManagedBy
}
I have looked all over but other "solutions" are offered but don't work for various reasons