Hello Forum!
Hope someone can help me troubleshoot this or even let me know if its not possible. But, I used powershell to import distribution groups and set primary emails in Office 365. That worked great, but we have two domains and i would like to add an email alias to all my DGs for the other domain.
This was my best attempt and its not going well:
Import-CSV "C:\distributionlists.csv" | foreach {Set-DistributionGroup "$_.Name" -EmailAddresses SMTP:$_.PrimarySmtpAddress,$SecondarySmtpAddress}
$_.Name is the column name for my DGs. IE: DL-IT
$_.PrimarySmtpAddress is the column name for my primary email. IE: IT@domain01.com
$_.SecondarySmtpAddress is the column name for my email alias. IE: IT@domain02.com