SMTP Sinks on Exchange Cluster

In an Exchange cluster environment with multiple active nodes, Exchange instantiates one IIS virtual server (And therefore one SMTP Virtual Server Instance) for each external interface of the cluster. This configuration is duplicated on each node of the cluster.

For example, if you have an Active/Active/Passive cluster, then the external interfaces might map to the individual nodes like so:

Ext. Node
-------------------------
EXV1 -> Node1
EXV2 -> Node2
Node3 (Passive)

On each node, there will be two SMTP Virtual Server Instances (VSI), labeled EXV1 and EXV2. Whenever a node becomes active, it starts the VSI that is associated with the external interface that is pointing to it. So if Node1 fails, and Node3 takes over servicing EXV1, then Node3 will start up its EXV1 VSI. Likewise if Node2 fails instead, Node3 will start its EXV2 VSI.

Since each SMTP instance has its own event bindings, you must register bindings that apply to any SMTP VSI that could become active at any time. For a clustered Exchange setup this means that you should register the SMTP Sink on every SMTP VSI that exists on every box.

Using the simple example in this KB Article (How to add a disclaimer to outgoing SMTP messages in Visual Basic script), instead of registering with just this:

cscript smtpreg.vbs /add 1 onarrival SMTPScriptingHost CDO.SS_SMTPOnArrivalSink "mail from=*@your-domain-here.com"
cscript smtpreg.vbs /setprop 1 onarrival SMTPScriptingHost Sink ScriptName "C:\EventSinkScript.vbs"

You would have to register additional bindings for all other instances (one for each active node). So for our Active/Active/Passive cluster mentioned above, you would register the sink like this:

cscript smtpreg.vbs /add 1 onarrival SMTPScriptingHost CDO.SS_SMTPOnArrivalSink "mail from=*@your-domain-here.com"
cscript smtpreg.vbs /setprop 1 onarrival SMTPScriptingHost Sink ScriptName "C:\EventSinkScript.vbs"
cscript smtpreg.vbs /add 2 onarrival SMTPScriptingHost CDO.SS_SMTPOnArrivalSink "mail from=*@your-domain-here.com"
cscript smtpreg.vbs /setprop 2 onarrival SMTPScriptingHost Sink ScriptName "C:\EventSinkScript.vbs"

If you look at the code in the SMTPREG.VBS file's "DisplaySinks" method you can see some hints on how to do this enumeration programmatically.