I have a script that sends out an email to a large number of distribution lists as a final steps. In testing, if I send it to one person it works fine. The issue comes in when I am trying to send to multiple recipients. I have looked at the Send-MailMessage help topic and it expects a string for the -To field. I would think that I could do something like this:
But all of them generate the same error:
Cannot process argument transformation on parameter ‘msgrecipient’. Cannot convert value to type System.String.
I have tried putting the names into an array and then using .Split or .ToString, but still cannot seem to get the syntax correct. Any suggestions would be welcome.