I am trying to import a CSV and configure -AcceptMessagesOnlyFrom property. I can run this for example:
<Set-DistributionGroup “group name” –AcceptMessagesOnlyFrom user1@domain.com,user2@domain.com>
But when i import a CSV like this:
<Import-Csv “C:\Import.csv” | ForEach-Object {Set-DistributionGroup -Identity $.PrimarySMTPAddress -AcceptMessagesOnlyFrom $.AcceptMessagesOnlyFrom -AcceptMessagesOnlyFromDLMembers $_.AcceptMessagesOnlyFromDLMembers}>
Then I get an error "
Set-DistributionGroup : Couldn’t find object “name1@abc.com name2@abc.com”. Please make sure that it was spelled correctly or specify a different object."
And so i think that i should separate those email addresses with a comma and I try that and get a similar error
Set-DistributionGroup : Couldn’t find object “name1@abc.com, name2@abc.com”. (the comma between the names.
And so I try any number of commas, and quotation marks, in the csv file and no worky. I don’t understand how to tell PowerShell, there is more than one email address (value) and that foreach value (email address) create an entry.