configuring exchange powershell hub transport rule script

Welcome Forums General PowerShell Q&A configuring exchange powershell hub transport rule script

This topic contains 1 reply, has 1 voice, and was last updated by

 
Participant
3 years, 7 months ago.

  • Author
    Posts
  • #28568

    Participant
    Points: -19
    Rank: Member

    I am working on a script to create multiple hub transport rules in Exchange 2010.

    My code is:
    `
    $names=@('foo','bar')
    foreach ($name in $names) {
    set-transportrule -identity "export" + $name + "test redirect domain1 to domain2" -sentto=$name+@domain1.org -redirectmessageto=$name +@domain2.org -state=disabled
    }
    `
    Is my set-transportrule line written correctly?? (in terms of syntax??)
    I know the other lines are syntactically correct (array, foreach)
    This is a multi-line script. Do I start it as a *.ps1 script inside the Exchange PS Shell, or what??
    Thank you, Tom

  • #28573

    Participant
    Points: -19
    Rank: Member

    I got it now...
    cls
    #Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010
    $names=@('tlyczko')
    foreach ($name in $names) {
    new-transportrule "export $name test redirect mls to mso" -sentto "$name@mountainlakeservices.org" -redirectmessageto "$name@ncmso.org"
    #set-transportrule -identity "$name test redirect mls to mso" -redirectmessageto "$name@ncmso.org"
    disable-transportrule "export $name test redirect mls to mso" -force
    }
    Now to play with it more etc.
    Thank you, Tom

The topic ‘configuring exchange powershell hub transport rule script’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort