How to add many IPs to allow for SMTP Relay

I have a list of IPs that I need to add to 4 separate Exchange 2003 SP2 servers that we have configured as the Internal Bridgehead servers.
These IPs need to be added to:Protocols-SMTP-Default SMTP Virtual Server-Default SMTP Virtual Server Properties-Access Tab-Relay

Does someone have a script?
Admin_StoogeAsked:
Who is Participating?
 
GundogTrainerConnect With a Mentor Commented:
If you download the IPSec.vbs utility from microsoft:
http://support.microsoft.com/kb/935635

replacing DOM-DC-1 with one of your domain controllers and adding your exchange servers to the list and save as something like AddSMTP.bat

if you then wanted say to add 192.168.20.1 to the SMTP ACL you would just  run

AddSMTP 192.168.20.1 255.255.255.255

Hint:
if you have a simple Excel sheet with all the allowed server names and IP addresses on them then you can write a simple formula to construct the command for you - and if you ever need to add another server\ rebuild one you can add the ACL easily by pasting into a command line window etc.



cscript Ipsec.vbs -d DOM-DC1 -o a -r connection -v %1 -m %2 -s Exch-srv01
cscript Ipsec.vbs -d DOM-DC1 -o a -r accept -v %1 -m %2 -s Exch-srv01
cscript Ipsec.vbs -d DOM-DC1 -o a -r relay -v %1 -m %2 -s Exch-srv01

cscript Ipsec.vbs -d DOM-DC1 -o a -r connection -v %1 -m %2 -s Exch-srv02
cscript Ipsec.vbs -d DOM-DC1 -o a -r accept -v %1 -m %2 -s Exch-srv02
cscript Ipsec.vbs -d DOM-DC1 -o a -r relay -v %1 -m %2 -s Exch-srv02

cscript Ipsec.vbs -d DOM-DC1 -o a -r connection -v %1 -m %2 -s Exch-srv03
cscript Ipsec.vbs -d DOM-DC1 -o a -r accept -v %1 -m %2 -s Exch-srv03
cscript Ipsec.vbs -d DOM-DC1 -o a -r relay -v %1 -m %2 -s Exch-srv03

Open in new window

0
 
GundogTrainerCommented:
To remove an entry its just a case of copying the script and changing the operation from "-o a" (add) to "-o d" (delete).
 so

cscript Ipsec.vbs -d DOM-DC1 -o d -r connection -v %1 -m %2 -s Exch-s

we have 6 relays with a internal dnsname and it makes keeping them all set the same quite easy.
0
 
Admin_StoogeAuthor Commented:
I'm following the instructions from the link you provided.
I have a text file with the 50 IPs in this format:
cscript IPsec.vbs –s exchange server name –o a –r relay –d domain controller –v      IP

I open a cmd prompt and go to C:\ExIpSecurity
I then run
C:\ExIpSecurity>addiprelay01.bat > addiprelay01results.txt

But when checking the output file, I see this:
Quitting: Syntax incorrect. Type 'ipsec.vbs' for usage.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.