• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 916
  • Last Modified:

script to add multiple domains in Microsoft Default SMTP Virtual Server

I am looking for a script that will allow me to add 200+ domains to the Microsoft Default SMTP Virtual Server.

We curretnly have 200+ domains setup in Microsoft SMTP, we are moving to a new colo, and I need to change all these domains from being LOCAL (Alias) to REMOTE.
Getting properties on each one does not allow me to change this.
Looks like I will have to delete all of them and recreate them.
Is there a way to do this through a script? They will all point to the same IP at our new colo.
1
kon21
Asked:
kon21
1 Solution
 
meverestCommented:
Hi,

use this to extract them all:

C:\Inetpub\AdminScripts>adsutil enum /SmtpSvc/1/Domain

You may need to parse them further using some scripting to find out if they are local or remote:

C:\Inetpub\AdminScripts>adsutil enum /SmtpSvc/1/Domain/remotedomain.com
KeyType                         : (STRING) "IIsSmtpDomain"
RouteAction                     : (INTEGER) 2


C:\Inetpub\AdminScripts>adsutil enum /SmtpSvc/1/Domain/localdomain.com
KeyType                         : (STRING) "IIsSmtpDomain"
RouteAction                     : (INTEGER) 16

To add them on the new server, script it using CREATE and SET commands:

C:\Inetpub\AdminScripts>adsutil create smtpsvc/1/Domain/newlocaldomain.com "IIsSmtpDomain"
C:\Inetpub\AdminScripts>adsutil set smtpsvc/1/Domain/newlocaldomain.com/RouteAction 2

C:\Inetpub\AdminScripts>adsutil create smtpsvc/1/Domain/newremotedomain.com "IIsSmtpDomain"
C:\Inetpub\AdminScripts>adsutil set smtpsvc/1/Domain/newremotedomain.com/RouteAction 16

Excel is a useful tool to build scripts for this purpose.

Cheers.

0
 
Jason MorganSenior Network ArchitectCommented:
I needed to import 300 domains into IIS/SMTP and this script was exactly what I needed. Thank you!
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now