On Windows PowerShell and other admin-related topics

Script to create a NLB-cluster for Exchange Server 2010

When documenting installations I perform I prefer to refer to scripts whenever possible, since this means less screenshots and a more concise reference.
When deploying Exchange Server 2010 on Windows Server 2008 R2, we have access to the new PowerShell-module for administering NLB. With this in mind I`ve created a script to set up a NLB-cluster for Exchange Server 2010 CAS/Hub-roles in Windows Server 2008 R2.

The script are interactive and will perform the following:

  • Ask for input for variables (cluster FQDN, operation mode, etc.)
  • Create the new cluster based on the variables provided by the user
  • Remove the default port rule
  • Add port rules for http, https, POP3, RPC, IMAP4, SMTP, MSExchange RPC and MSExchange Address Book Service
  • Ask for the addition of additional nodes. Loops through this procedure until the user answers no


  • Install the NLB-feature (may be accomplished from the ServerManager module in PowerShell by executing Add-WindowsFeature NLB)
  • Configure the NLB NIC`s with the approriate name, IP-address and subnetmask (and disable “Register this connection`s addresses in DNS”)
  • Manually add the cluster FQDN to DNS
  • Configure static ports for the MS Exchange RPC and MS Exchange Address Book Service (see links in the resource section below)
  • Eventually, configure your network switches/routers based on the cluster operation mode you choose



The script are available from here. In a later revision I`m considering adding support for installing the NLB-feature (I dropped it for now since it could only be offered on the server running the script from, not the additional nodes. This can however be accomplished using PowerShell Remoting), setting the dedicated IP-addresses for the NLB NICs and turn off “Register this connection`s addresses in DNS”.

If you don`t want the interactive experience, replace the “Read-Host” sections with the actual variable values.

Please let me know in the comments below if you have any suggestions for improvements.

Related resources

Exchange Server TechCenter: Understanding Load Balancing in Exchange 2010
Exchange Server TechCenter: Load Balancing Requirements of Exchange Protocols
Microsoft TechNet Wiki: Configuring Static RPC Ports on an Exchange 2010 Client Access Server
Bhargav Shukla (MSFT): Script to configure static ports on Exchange Server 2010
Windows Server TechCenter: Network Load Balancing
Microsoft’s Failover and Network Load Balancing Clustering Team Blog: PowerShell for NLB
Kraft Kennedy: Configuring NLB for Exchange 2010 CAS Load Balancing


May 21, 2010 - Posted by | Exchange Server 2010, Network Load Balancing, Scripting, Windows PowerShell |


  1. great script but if you don’t want to use static IP on the NLB nic. this is only if you want a dedicated nic for your NLB.

    and want to install the NLB feature adjust the script
    at the TOP to give your nic a fake fixed IP – later removed
    Netsh interface ip set address name=”NLB” static
    add the NLB to the server
    Add-WindowsFeature NLB

    right after the port creation before add nodes remove the fake IP
    Remove-NlbClusterNodeDIP -force

    Comment by robert smit | June 24, 2010 | Reply

  2. Thanks! With some small modifications it works flawless.

    Comment by Robbe | July 29, 2010 | Reply

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: