How to use set-transportrule

Welcome Forums General PowerShell Q&A How to use set-transportrule

Viewing 2 reply threads
  • Author
    Posts
    • #112031
      Dan
      Participant
      Topics: 1
      Replies: 0
      Points: 1
      Rank: Member

      Hello,

      I have already created a new transport rule using the “New-TransportRule”.

      But now I wish to modify the existing transport rule using the “Set-TransportRule”.

      I wish to add three more additional email addresses to the existing email addresses without affecting the remaining Properties.

      Get-Transportrule “MOFIS Redirect” | fl FromAddressMatchesPatterns

      FromAddressMatchesPatterns : {meapfpjq@aaa.ac.uk, meapfqal@bbb.ac.uk, meapftrg@ccc.ac.uk}

      If I ran this command would it append to existing email addreses without affecting the remaining Properties?
      Set-Transportrule “MOFIS Redirect” -FromAddressMatchesPatterns “mea1@ddd.ac.uk”,”mea2@eee.sc.uk”,”mea3@fff.ac.uk” -RedirectMessageTo “ebswftest@mdx.ac.uk”

      Thanks

       

       

       

       

       

       

       

       

       

       

       

       

    • #112046
      Participant
      Topics: 1
      Replies: 302
      Points: 147
      Helping Hand
      Rank: Participant

      The documentation on this is not very helpful, is it?

      I’m not familiar with the cmdlet but everything I’ve read suggests that existing addresses will be overwritten.  The general consensus is that you have to update the collection. e.g

      $collection = New-Object Collections.ArrayList
      
      $collection = Get-Transportrule "MOFIS Redirect" | Select -ExpandProperty FromAddressMatchesPatterns
      
      $collection += 'mea1@ddd.ac.uk','mea1@ddd.ac.uk','mea2@eee.sc.uk','mea3@fff.ac.uk'
      
      Set-Transportrule "MOFIS Redirect" -FromAddressMatchesPatterns $collection -RedirectMessageTo "ebswftest@mdx.ac.uk"
      
      
    • #112138
      Participant
      Topics: 2
      Replies: 31
      Points: 48
      Rank: Member

      Yes, the list of addresses will definitely get overwritten.  I verified with my own testing.  You will need to include the original email addresses in the list of additional ones.  You can add all of the addresses in a text file and use the get-content command as the parameter input:

      
      Set-TransportRule "MOFIS Redirect" -FromAddressMatchesPatterns (get-content c:\addresses.txt)
      
      

       

Viewing 2 reply threads
  • The topic ‘How to use set-transportrule’ is closed to new replies.