This script was created to automate the process of updating the SMTP relay list on our servers. It is a PowerShell script that creates a text file with the IP addresses of the SMTP relays, copies the file to each server, and starts the task on the server. The task runs a VBScript that imports the IP.txt file, and updates the SMTP relay server list. The VBScript was adapted from How to import a list of IP addresses into a Microsoft SMTP relay server
- Creates an update text file with allowed IP addresses.
- Copies the file to each server
- Starts the task on the server
- On each SMTP server
- Put a copy of the importRelayList-Update.vbs
- Use the UpdateSMTPRelay.xml templat to create a scheduled task to run the VBScript
- On you jumpbox or automation server
- Put the ProvisionAndDeprovisionSMTP.ps1
- Update notated locations in the script for your environment
- Run the PowerShell script with parameters example
.\ProvisionAndDeprovisionSMTP.ps1 -IpAddress "192.100.10.5" -SubnetMask "255.255.255.255" -AddOrRemove Add
- The PowerShell script will create the IP.txt file, copy it to each server, and start the task on the server
- The task starts script importRelayList-Update.vbs that imports the updated IP.txt file, and replaces the existing allowed IP relay list.
- PowerShell v3 or higher