How to Build a SharePoint Server 2016 image

    I build a lot of SharePoint farms; I mean a lot of the daggone things. It's like I'm Jesse, from the first Fast and the Furious movie. Building servers and SharePoint farms calms me, it's like putting a big puzzle together and I have to get all the pieces in the right place for it to work together as it is supposed to.

    Of course, those of you that have been working with SharePoint longer than a week know that a lot of that is much easier said than done.

    Anyway, despite my love for putting the puzzle together there are certain aspects of it that have grown tiresome, in particular installing Windows Server and then SQL and/or SharePoint and everything that goes with those little processes.

    Several years ago I started using SYSPREP to build my server images and it was while I was building servers for yet another farm a few weeks ago that I had a thought………why can't I install the SharePoint prerequisites and binaries and then SYSPREP the server? I broke out the Goo-fu and did a little Google searching and indeed it has been done before.

    Excellent, so why am I writing it again? Probably more for my benefit than anything, at my age you tend to forget things a little more easily, versions of software (OS, SharePoint, SQL, etc.) change, and because it's late and I feel like writing.


    If you don't read another word, please read the following:

    What I am doing here is not intended to be used in production. If you want to assume the liability and try it, go for it. Know that it's on you to verify how this is supported by Microsoft in a production environment and that my intention is to show that it is how I am doing things in my DEVELOPMENT environment.


    And that is probably as close to being a developer as I am ever going to get J

    Now, on with it…


    In this particular configuration I am going to be working with Hyper-V on a Windows 10 laptop that has 32 GB of memory and about 1.5 TB of hard drive space. 250 GB of that is an SSD drive where I will store my server images (as .vhdx files) after I have run SYSPREP on them.

    Everyone builds their test and development instances differently. In the past I would usually have a standalone domain controller, a standalone SQL Server and at least 4 SharePoint Servers. I'm here to tell you that probably isn't going to cut it with SharePoint 2016. You'll get SharePoint installed but will have issues with errors related to a lack of system memory. Those issues will prevent many SharePoint 2016 features from operating at all.

    For this instance, I want a domain controller, a SQL 2014 SP1 Server and a SharePoint 2016 Server So I am going to start by creating 3 folders on my SSD drive, one each for the Windows Server 2012 R2 base image, one for the SQL 2016 server and the third for the SharePoint 2016 image. Once that's done I'll open the Hyper-V Management Console and create a new virtual machine and install Windows Server 2012 R2 with update. I'm not going to walk you through those steps, I'm assuming you know how to do that, if not here's a link to the most recent TechNet documentation available as of this writing.


    Once I've installed and fully patched the operating system I make the following changes:

    1. I Set the time zone to Central US.

    2. I turn off IE Enhanced Security Configuration for both administrators and users.

    3. I install any applications I want available on the server (Notepad++, PowerShell tools, etc.)

    When all the available updates have been installed, the desired applications installed and any specific configuration changes made it's time to run SYSPREP.

    NOTE: It's important to understand that when you generalize the server using SYSPREP you are going to erase any local profiles for the account you're logged in with. That means that any changes that are normally specific to a profile like desktop shortcuts, taskbar shortcuts, etc. are going to be lost when the server is generalized.

    On the server log in as a local Administrator and take the following steps.

    1. Open a command prompt.

    2. From the command prompt navigate to Windows > System32 > SYSPREP

    3. From the command line enter the following to execute the SYSPREP command and generalize the virtual machine.

    sysprep<strong>.</strong>exe <strong>/</strong>oobe <strong>/</strong>generalize <strong>/</strong>shutdown <strong>/</strong>mode<strong>:</strong>vm

    The /mode:vm switch is only available from the command line and allows you to make a copy of the VHD that is created as a result of running the command and then use that .VHD as the base image for multiple virtual machines.

    IMPORTANT NOTE: It's important to understand that there are a number of factors that play into the exact number of times you can reuse an image. The key factor appears to be regarding product key type. In the past you had to use the SkipRearm command to reset the Windows Product Activation clock. In most Windows 8 and newer deployment scenarios this is not necessary.

    If you specify a volume or retail product ley Windows will automatically activate. You can then run the SYSPREP command up to 8 more times on that image before you MUST create a new image.

    Source: TechNet: Work with Product Keys and Activation

    TIP: to see how many activations remain on your Windows installation run slmgr.vbs /dlv from the command line and look for the "Remaining Windows Rearm Count" in the Windows Script Host dialog box that pops up.

    OOBE: or out of the box experience is considered to be the first user experience configuration. In other words, the individual doing the installation will have to go through the initial Windows Server setup and configuration.

    Generalize: The generalize process
    removes system specific information such as the SID or unique machine identifier. This allows the image to be reused multiple times.

    Shutdown: in order for sysprep to complete successfully and the image be completely prepared for reuse it is necessary to shut the machine down. If the server reboots it will run through the configuration wizard and you will have to run sysprep again and if you select the Quit option, there is a possibility that some changes may not be written to the image correctly.

    Once SYSPREP has completed the virtual machine will shut down and I can take my next step which is to copy the .vhdx file from the virtual machine I just ran SYSPREP on to my SP2016Base folder and rename it to SP2016Base.vhdx.

    Creating the base image for SharePoint Server

    To build my single SharePoint 2016 server I am going to open Hyper-V and go through the standard New Virtual Machine creation process until I get to the 5th step where the wizard asks me to create a virtual hard disk, use an existing hard disk or attach a virtual hard disk later.

    NOTE: In this case I am allowing the VM to connect to the internet in order to download and install the SharePoint Server 2016 prerequisites. Once the prerequisites have been installed and the server image created it will not be connected to the internet again.

    With the network connection set I am going to select "Use an existing hard disk", browse to my SP2016Base.vhdx file and select it.

    Now, I'll complete the wizard and let the virtual machine creation process run. Once the VM has been created I am going to open the settings console and change the number of virtual processors to 4.

    With the number of virtual processors set I am going to start the VM for the first time and then watch as it goes through the Windows setup process. Once I have skipped entering my PID, accepted the EULA, and set an administrator password I can log into my new virtual machine for the first time.

    At this point I am going to change the server name and restart it so I can set Hyper-V remote desktop console to open in full screen mode.

    My server is ready for me to install my SharePoint prerequisites and binaries now, for the purposes of this example I am just going to use the GUI but you could certainly script the installation of the prerequisites and binaries if you wanted to.

    The installation of the prerequisites will require at least one restart of your server. When the prerequisites have completed installing restart the server and then run the binary installation.

    When the installation wizard completes make sure you uncheck the box for "Run the SharePoint Products Configuration Wizard now". Click the close button to close the wizard.

    Post Installation Steps

    With SharePoint Server 2016 installed you can now turn your attention to any updates or SharePoint related patches you want to run. In addition to running Windows update and picking up any SharePoint or Office related patches or updates I am going to install the June 2016 CU. Once again after the CU has been installed I will not run the configuration wizard.

    I will however run SYSPREP again the same way I did previously.

    1. Open a command prompt.

    2. From the command prompt navigate to Windows > System32 > SYSPREP

    3. From the command line enter the following to execute the SYSPREP command and generalize the virtual machine.

    sysprep<strong>.</strong>exe <strong>/</strong>oobe <strong>/</strong>generalize <strong>/</strong>shutdown <strong>/</strong>mode<strong>:</strong>vm

    All I have to do now is join the server to a domain, build a SQL server and run the configuration wizard. What's that? Is there a way to create an image of a SQL Server?



    Subscribe Here!

    Recent Posts

    Posts by Topic

    see all