Well hello there fanciful friends and lovers of all things Exchange! Have I got a treat for you today or have I got a treat…. I have been wiling away my evenings in earnest over the last couple of days all in an effort to reduce the amount of time that I spend on doing an Exchange build, to develop a more repeatable process, and then as a result make each environment I setup a consistent and standard build.
So what is this unicorn tool that I stumbled across recently and just so happened to be as interesting to me as Ryan Gosling with his top off –
Exchange v15 Unattended Setup: https://eightwone.com/2013/02/18/exchange-2013-unattended-installation-script/.
All credit for this most awesome tool goes to Michel de Rooij of whom I have just become his number 1 fan. Alas all jokes aside and onto the serious business of how this little gem of a script works. Michel’s post does a truly excellent job of laying out the foundations for this tool I however wanted to put something a little more descriptive together for my fellow Exchange Evangelists.
Let’s get started… I familiarised myself with the script in a dev. environment and would highly recommend that you do the same first. Whilst the code is excellent and has been put together very well it is still wise to understand what the tool is doing etc. before you gun-ho into a production environment.
Simplistically the script cycles through 6 phases, if you specify the -AutoPilot switch and enter in credentials the script will manage all of the reboots and once the server is back online will login and resume activities from the last phase. It does this by writing to a state.xml file which is stored in the same install location specified when executing the script, once the script has finished executing the phase that it is currently in the results are written to that same state file each time.
Phase 1 – Install Windows Features and Operating System Prerequisites
Phase 2 – Install Exchange Prerequisites
Phase 3 – Install Exchange Prerequisites Continued
Phase 4 – Install Exchange and Prepare Schema
The script has a lot of smarts built into it, one that I particularly love is that I have the ability to run the script using the -NoSetup switch which basically means I can get all of the pre-req’s for Exchange and the OS installed including features automatically! The script will work out the version of Exchange that I am planning to install through specifying the source directory of the installation files and from that will determine the pre-reqs and features that need to be applied.
If the script has access to the internet it will download the most recent packages etc. and save them to the specified install directory – pretty cool eh?!
Onwards, I tend to break my installations down into 3 components:
- Install pre-requisites, windows features and any other OS components that need to be applied or installed.
- Update and prepare AD – if you are a reader of my blog usually you will know that this is my most hated phase and the one that I always seem to run into trouble with!
- Install Exchange 2016 – YAY 🙂
Using this script I have been able to automate steps 1 and 3. I typically, unless I am doing a brand new build of Exchange tend to do the prepare AD step manually. I do this primarily because I am a control freak and like to see what’s happening, but also because I have been scared off of this step way too many times in the past with things going wrong.
For step 1 I have adopted this process using the script (I may change this, I am a girl after all):
- Download and extract my Exchange setup files to C:\ExchangeSetup
- Download and extract (if required) any pre-requisite files to C:\Temp
- Copy the script to C:\Install
- Open a command prompt using elevated privileges aka. as an administrator / god / keeper of secrets/ commander of the universe – whatever term you like to call those with domain admin rights.
- Run the following from C:\Install – .\Install-Exchange15 -NoSetup -SourcePath c:\ExchangeSetup -InstallPath c:\Install -IncludeFixes -InstallFilterPack -Verbose
.\Install-Exchange15 -NoSetup -SourcePath c:\ExchangeSetup -InstallPath c:\Install -IncludeFixes -InstallFilterPack -Verbose
I’ve taken a series of screenshots of this voodoo magic in action:
As part of the prerequisites installation, there are a number of restarts that need to be completed. The script will take care of this process if the autopilot option is enabled. In addition if you specify credentials the script will also auto login after the reboot has completed.
After the prerequisites have installed, the script will complete running and if you haven’t chosen to use the autopilot feature which I haven’t, you will need to do a restart and then kick the script off again to move onto the subsequent phases.
The next few phases are the actual installation of Exchange 2016, again this script makes it effortless all I had to do was make myself a cuppa and watch the magic happen! This is the command that I used to do the install:
.\Install-Exchange15.ps1 -InstallMailbox -SourcePath C:\ExchangeSetup -TargetPath $path -InstallPath c:\Temp -MDBName DB1 -MDBDBPath E:\ExData\DB1 -MDBLogPath E:\EXLogs\DB1 -DisableSSL3 -IncludeFixes -SCP https://ServerName/Autodiscover/Autodiscover.xml -Verbose
As I was running an Exchange 2016 installation in coexistence with Exchange 2010 I chose to use the -SCP switch to set the Service Connection Point to the same as Exchange 2010 so as to eliminate any potential cert errors with Outlook from popping up. As you can see, the script offers the flexibility to create the DB’s as part of the installation and specify the location of those and the log files. It also provides the ability to disable SSL3 and install any fixes that may be applicable all as part of the install process.
I chose to use the -Verbose switch for the entire process as I am again a control freak and like to have the visibility over what the script is doing at each step, it’s also quite helpful if things don’t go according to plan and you need to see at which step the failure occurred. This helps as I could then go back to the script and work out what function we were up to when the failure happened and what I needed to do to get it past that point.
Overall I am really impressed with this tool, the attention to detail and what it actually does for me as a consultant makes it an invaluable tool to have in the back pocket. I also hope that it will be something that I will continue to use and may inspire others to have a go with.
Happy Exchange installing!