Add email addresses to an exchange transport rule via PowerShell

Nick Paramonov 46 Reputation points


I need to script adding new email addresses to transport rules via powershell.

I can get the list of email addresses using Get-TransportRule | Select-Object -ExpandProperty From

Which gives me the full list of addresses in this rule as a plain text. How do I script appending more addresses there?

Microsoft Exchange Online Management
Microsoft Exchange Online Management
Microsoft Exchange Online: A Microsoft email and calendaring hosted service.Management: The act or process of organizing, handling, directing or controlling something.
4,167 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Vasil Michev 95,081 Reputation points MVP

    It's an array actually, and you can add to it:

    $from = Get-TransportRule "blabla" | select -ExpandProperty From
    $from += "user1"
    $from += "user2","user3","user4"
    Set-TransportRule "blabla" -From $from
    0 comments No comments