0

I have 128 MailFlow rules within an exchange 2013 server. I am looking for a way to turn on or turn off all the rules with a powershell script.

I know that I can use

Disable-TransportRule "RuleName"

to turn off a rule.

My problem is trying to incorporate that in to a loop with powershell. I just don't have the knowledge of the powershell language. I've read up about loops and tried using variations on:

$rule = Get-TransportRule
Foreach($r in $rule)
{Disable-TransportRule $r.indentity}

However the loop fails with 2 or 3 errors. Can anyone help or does anyone have any decent links to Powershell tutorials so that I can self-learn powershell loops and coding.

Matt Bartlett
  • 348
  • 1
  • 3
  • 21

0 Answers0