Forum Discussion
Edit a transport rule with PowerShell
I have a transport rule that contains a large number of whitelisted IP addresses. I'm trying to remove the obsolete IP addresses from this list using PS.
From what I have seen so far it can be done in PS with the Set-TransportRule cmdlet.
Set-TransportRule -Identity "<Name of Rule>" -SenderIPRanges xxx.xxx.xxx.xxx
What I cannot seem to find is switch that will remove that IP address from the list. is it as simple as using $False or -Remove? I have not tried to run the command in case it removes all of the IP addresses in the rule.
1 Reply
In general, you should be able to use the following syntax:
Set-TransportRule blabla -SenderIpRanges @{Remove="1.2.3.5"}
However, it doesn't seem to work as expected in this case, it nullifies the whole object. So your other option is to "manually" export the list to notepad/Excel and paste it back with the IPs added/removed as needed.