On Prem Exchange Windows Server 2012 Essentials: The Script!

Exchange2A few months back, i posted up about how to deploy the On Premises Integration between WSE12 and Exchange.

powershell2xa4As part of that post i completely glossed over the method to install the Exchange Server promising to publish the PowerShell script i had written ‘soon’.

Today, my great friends, is that day.

You can download it from the TechNet Gallery where i put all of my scripts and tools.

It seems that Installing Exchange is something that some people have never done. Which is understandable if they have only ever worked with SBS or related products. SBS of course did the heavy lifting of server installation for us, by wizardising (yes that is a word) the setup in 2003 and by deploying image based systems in the 2008 and 2011 OS.

So, unless you had picked up some bigger clients, you probably never looked at Exchange in any more detail than you needed to. I remember when Exchange 2007 was released, and i first tried to install it on a 2003×64 OS, it took me about 3 weeks to find all the pre-requisite hotfixes and patches before it would even attempt to install. Needless to say, it was not straight forward. Of course that has all changed now (I haven’t looked at the newest version of Exchange yet so it could well have changed back) Anyway i am rambling slightly and you probably want me to get to the point.

It is actually easier to install Exchange via the Command Line method, than the GUI. For an IT Pro (or MSP) the key thing, i think, is a consistent deployment. Using a GUI allows you to choose this and that, but a command, is a command, and a command can be set in a script and not altered – producing a consistent result. In conversation with other MVPs we were talking about deploying the On Prem Exchange and the time it took, and i mentioned ‘i can deploy exchange with two commands’, Of course a bold statement, but nether the less true (if you ignore the fact it was installed, but not configured)

That was the basis for the script, and tool that evolved from it.

The tool will do several things:

  • Install Exchange
  • Run Exchange Configuration
  • View Exchange Configuration
  • Request an SSL Certificate
  • Complete SSL Installation
  • Import an Existing SSL Certificate

Server Prep

Before i go into how the tool works, lets make sure we can run through this together?

    Once you have downloaded the tool, you will need to place it in the Exchange media folder. If you are using an Exchange DVD, i would ask you to copy the contents to a Folder on a Server, and put the tool inside that folder.In my testing i downloaded an Exchange 2010 trial, and extracted the media out to a folder called ‘Ex’

      You will need to open an Elevated PowerShell window, and set your ExecutionPolicy to RemoteSigned.
        Set-ExecutionPolicy RemoteSigned

      You will need to accept the change to the policy.


    Once you have done that, you are ready to work with the tool. I went through the rest of the Server prep in my other post, but just to recap it was Server 2008 R2 w/SP1 with the Essentials Connector installed. Your Administrator account should also be a member of the Enterprise Admins group.

    Install Exchange

    To run the tool simply type .\Mini-Ceicw.ps1 in to your PowerShell window.


    As you can see you will be presented with a menu giving you several options, all of which are disabled unless Exchange is installed.

    Entering ‘1’ Will attempt to install Exchange.


    If you don’t meet the Pre-Reqs you will be prompted to install them.


    Once you have installed the required Windows Features, you must reboot.


    This time if you run the Tool again, you will see the Installation begins..


    So, here is where we start to do some clever things with PowerShell.

    You are prompted to enter in your FQDN, the name with which you access your Exchange server over the internet. In an SBS network this is usually something like mail.company.com, or remote.company.com.

    That’s it, Exchange is then installed with a Command Line install, and the most common components are chosen. it also configures your server, with the remote server name you specify.

    The command i use is: Setup.com /r:”c,h,m,mt” /on:First Organization” /ExternalCASServerDomain:”$domain”

    In this instance, $domain is a variable value, taken from the input you type when asked for your FQDN.

    So, if you wanted to do this, without this script you could use:

    Setup.com /r:”c,h,m,mt” /on:”First Organization” /ExternalCASServerDomain:”remote.company.com”

    More info on that can be found here.

    At this point the tool hands over to the Exchange Unattended install routine, so any errors at this point are not to do with the tool but with the environment within which you are trying to install.

    Assuming the Organisation checks pass, the tool goes ahead and installs Exchange.


    Then, we are back to the tool, it will install the Office 2010 filter pack, and also go ahead and enable Outlook Anywhere, as well as set all of the URLs for services like AutoDiscover, OWA, EAS and Exchange Web Services.

    All of those commands are hidden and rely solely on the $domain variable that we inputted above.

    Once all that has been done, you will be returned to the main menu. You will notice this time that the Install Exchange item is now greyed out (as it will be at any subsequent re run) and you can now chose one of the other options.


    We now have the option to:

    • Add Accepted Domain (ie yourcompany.com)
    • Add Email Address Policy (to configure how email addresses should be, ie rob@ or robp@)
    • Add a Send Connector (er, to Send email, this will also support sending via alternate ports and a smart host)
    • Add a Receive Connector (to receive emails)
    • Enable Anti Spam tools (to enable anti spam tools)
      I don’t want to spoil your fun with the tool so i am not going through every single possible action that you can achieve, so i would encourage you to download it and play with it. I do welcome any feedback you have, however i must stress..

    The tool is provided AS IS, with no warranty and no support. I do not accept any liability for it’s use, miss-use, or any loss arising from it’s use. Reading this aloud or in your ahead waives any liability on my part in perpetuity throughout the universe.

    On a side note, i did put together a very short video demonstrating how you can enable your SSL certificate using the tool.


    So, that is all really, hope you can make some good use of the PowerShell tool, if you do have any questions or comments then please use the Q&A section on the TechNet Gallery. Thanks!

    I would like to thank Justin Crosby of Microsoft CSS, Susan Bradley for testing and generally being Susan, and last and least, Tim Barrett for always believing in me and being there to offer no help whatsoever apart from sarcastic comments.

    About Robert Pearman
    Robert Pearman is a UK based Small Business Server enthusiast. He has been working within the SMB IT Industry for what feels like forever. Robert likes Piña colada and taking walks in the rain, on occasion he also enjoys writing about Small Business Technology like Windows Server Essentials or more recently writing PowerShell Scripts. If you're in trouble, and you can find him, maybe you can ask him a question.

    One Response to On Prem Exchange Windows Server 2012 Essentials: The Script!

    1. Justin Maas says:


      Any chance this script will be update fro Exchange 2013?



    Leave a reply

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

    WordPress.com Logo

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

    Facebook photo

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

    Connecting to %s

    This site uses Akismet to reduce spam. Learn how your comment data is processed.

    %d bloggers like this: