Find me in different places

Configuring Exchange 2013 with Powershell- Part 1: Networking

When starting the process of configuring Exchange 2013 servers the first place I wanted to start was networking, I wanted to be able to just pass in some MAC addresses of the NICs and give them IPs, I also wanted everything to happen automatically. Using Powershell 3 made this easier then it used to be in older versions.

The first step to build 3 arrays. The first will hold the MAC address, the second the new names, the third the new IP addresses. An example can look like this:

[array]$macAddresses = "00-15-5D-00-0C-58","00-15-5D-00-0C-59",,"00-15-5D-00-0C-5A","00-15-5D-00-0C-5B","00-15-5D-00-0C-5C","00-15-5D-00-0C-5D"
[array]$nicNames =    "Management", "DAG", "iSCSI 1", "iSCSI 2", "iSCSI 3", "iSCSI 4"
[array]$ipAddresses = "", "", "", "", "", ""

The second is to make a loop that will go through and configure the NICs. One thing to note: make sure you have exactly the same number of data in all 3 loops in the correct order otherwise the NICs will be incorrectly configured.

for($i=0; $i -lt $macaddresses.Length; $i++){         
     [string]$macaddress = $macAddresses[$i]          
     Get-NetAdapter | Where-Object {$_.MacAddress -eq "$macaddress"} | Rename-NetAdapter -NewName $nicNames[$i] 
     New-NetIPAddress -InterfaceAlias $nicNames[$i] -IPAddress $ipAddresses[$i] -PrefixLength 24 

This loop will through and name the NIC based on the corresponding MAC address and then give it the IP , also setting the subnet mask. All of the cmdlets going forward are based on the interface name, it is crucial to have the interface name set correctly.

Now being able to change the name and IP is cool, but what about all of the other things that needs to get done to an interface? DNS, Jumbo packets? We can do all of that in Powershell! For example for a DAG NIC, you might want to do the following:

Set-DnsClient -InterfaceIndex DAG -RegisterThisConnectionsAddress: $false
#Disables NIC features for replication network that are not needed
Set-NetAdapterBinding -Name DAG -DisplayName "Client*" -Enabled $false
Set-NetAdapterBinding -Name DAG -DisplayName "File*" -Enabled $false

How about for the iSCSI network?

Set-DnsClient -InterfaceIndex iSCSI -RegisterThisConnectionsAddress: $false
#Enable Jumbo Packets
Set-NetAdapterAdvancedProperty -Name iSCSI -RegistryKeyword “*JumboPacket” -Registryvalue 9014

Now lets put it all together as one script:

[array]$macAddresses = "00-15-5D-00-0C-58","00-15-5D-00-0C-59",,"00-15-5D-00-0C-5A","00-15-5D-00-0C-5B","00-15-5D-00-0C-5C","00-15-5D-00-0C-5D"
[array]$nicNames =    "Management", "DAG", "iSCSI 1", "iSCSI 2", "iSCSI 3", "iSCSI 4"
[array]$ipAddresses = "", "", "", "", "", ""

for($i=0; $i -lt $macaddresses.Length; $i++)
     [string]$macaddress = $macAddresses[$i]
     Get-NetAdapter | Where-Object {$_.MacAddress -eq "$macaddress"} | Rename-NetAdapter -NewName $nicNames[$i] 
     if($nicNames[$i] -eq "Management")
         New-NetIPAddress -InterfaceAlias $nicNames[$i] -IPAddress $ipAddresses[$i] -PrefixLength 22 -DefaultGateway
         Set-DnsClientServerAddress -InterfaceAlias $nicNames[$i] -ServerAddresses,
     if($nicNames[$i] -like "DAG")
        Set-DnsClient -InterfaceIndex $nicNames[$i] -RegisterThisConnectionsAddress: $false
        New-NetIPAddress -InterfaceAlias $nicNames[$i] -IPAddress $ipaddresses[$i] -PrefixLength 28
        #Disables NIC features for replication network
        Set-NetAdapterBinding -Name $nicNames[$i] -DisplayName "Client*" -Enabled $false
        Set-NetAdapterBinding -Name $nicNames[$i] -DisplayName "File*" -Enabled $false                
     if($nicNames[$i] -like "iSCSI")
       Set-DnsClient -InterfaceIndex $nicNames[$i] -RegisterThisConnectionsAddress: $false
       New-NetIPAddress -InterfaceAlias $nicNames[$i] -IPAddress $ipaddresses[$i] -PrefixLength 24
       #Enables Jumbo Packets for iSCSI NICS only
       Set-NetAdapterAdvancedProperty -Name $nicNames[$i] -RegistryKeyword “*JumboPacket” -Registryvalue 9014
write-host "Configured NIC:"$nicnames[$i]

So by running this 32 line script you can guarantee that all of you NICs are configured correctly. It is also much faster then manually doing each step.

As I have said before, my ideas may not follow best practices, make sure you do your research to make sure configure your adapters correctly.

In my next post I will talk about installing the prerequisites for Exchange 2013

NOTE: You will either need to be running Server 2012 or have already installed WRM 3.0 to use these cmdlets


Why Use Powershell?

As I was working away the other day on my very long Exchange 2013 configuration Powershell script I was asked why I was spending so much time working on the script that I would only use one time, and that it would be 'faster' if I just did everything manually. This really started me thinking, "Why am I spending so much time on this script?" It came to me later in the day while I was trying to diagnose an issue in another system, that if that system was configured in PowerShell I could go back and see the steps that were taken and that would make finding the problem easier.
Another time last year I started getting complaints of problems with OWA in the 2010 deployment, I knew the problem had to due with the virtual directory somehow. But to find which server had the problem I had to stop IIS on each CAS and check until I figured out which one of the three was not working, the issue had to do with a step that was missed when it was first deployed, if it was configured using PowerShell all of the servers would have been configured exactly the same. 

This brings me to the current project that I am working on, I understand that I probably spent more time writing it then I would have saved if I had done everything manually. But if I ever leave the organization anyone can go back and see exactly how Exchange was deployed, and mostly it was a challenge I gave myself. I wanted to see if I could completly setup Exchange without needing to do anything manually; so far I am at 520 lines and I haven't found a single step that I couldn't find a work around for.

I think Powershell is a great tool that Microsoft has built, I have been really impressed with all of the changes they made in Powershell V3, it is a huge leap forward.

Last night I was watching Jeffrey Snover give the keynote at the NIC conference, I found what he said really interesting, he talked about how the industry is changing and how to be ahead of the curve. PowerShell is so powerful and how it has changed the way people do their jobs, it has changed my job. I really enjoyed his thought about how to stay relevant you have to constantly re-invent yourself.  You can watch it here. Thanks to everyone who posted the link on Twitter. If you want to learn more about PowerShell I recommend watching this, I have only watched half so far, but it is really good, there are a ton of things I didn't know it could do. Everyday I find a new awesome feature.

Have a favorite PowerShell feature or cmdlet? Post it in the comments or just tweet it with the hashtag #PowerShell


Designing for Exchange 2013 

This is the first part of a series of blog posts about making the transition from Exchange 2010 to 2013. A disclaimer: "Some of my thoughts and implementations may not follow Microsoft best practices, Please read all of the guides posted on technet, I take no responsibility if my suggestions do not follow best practices" 

Now that all of that is over lets talk about my environment. When migrating from Exchange 2007 to 2010 I went from physical servers to virtual servers running on Hyper-V, and even though I love Hyper-V as a hypervisor, I found Exchange to become somewhat unstable and would encounter the OS to lock up causing database failovers. When starting this process I decided to back to physical servers. 

To best size your hardware for your Exchange 2013 environment the best place is to start is the Exchange 2010 sizing calculator, found here. As of this writing the 2013 calculator has not been released, but is supposed to come soon. 

In my environment I will be hosting the databases on a pair of Dell Equallogic SANs, the physical servers will connect to the SANs through iSCSI. 

When picking servers I went with a pair of Dell PowerEdge R520's configured with 8 cores and 16 GB of RAM. For hard drives I chose 4 X 100GB SSDs configured in RAID 1, the first pair will host the OS while the second pair will host Exchange and the swap file. I am very excited to try out the SSDs, the cost has come way down recently and was in the budget, I will report back after using them for a while.

For load balancing, I choose a load balancer from Kemp Technologies, I have been very impressed with their solutions so far, they have a great support staff and make great products.

This is going to be my environment, Next I will start talking about some learnings about configuring NICs using Powershell

For those interested in seeing some designs of the setup you can download the PDF's below. Please note that they are pretty rough, I used them to get a general layout of my environment. You can make your own designs by using the Visio templates from Technet

Network Design
Database and CAS role layout
Storage Design
DNS Design


The road to Exchange 2013

My first major project that I am going to blog about is transition from Exchange 2010 to Exchange 2013. 

As of this writing Microsoft has not released Exchange 2010 SP3 which is required to perform an upgrade, Microsoft has said  that SP3 will be released sometime in the first quarter of 2013. So in the mean time I can take the time to plan and test so I will be ready when SP3 is released. 

When starting this project my goal was to complete everything using 100% powershell. I find Powershell to be extremely powerful, as someone with a pretty extensive programming background I find powershell very easy to understand. I wanted to be able to script everything from configuring network interfaces to Equallogic SANs and even Kemp Load Balancers. Microsoft has made Powershell more powerful in version 3 that ships with Server 2012/ Windows 8 and in a download for Server 2008 R2 and Windows 7. When starting this project I found a lacking of posts talking about all of the cool new things that Powershell 3 can do, I hope to document my findings here.

Coming up next I will talk about some design decisions. I highly recommend listening to The UC Architects podcast at: to keep up on the latest news on Lync and Exchange.


Blog Reboot

I have been wanting to start blogging again. This time I will be blogging on specific projects that I am working on, detailing specific learnings and tips.

Page 1 2