Using Sysprep with SQL Server (and SharePoint Server too)

As soon as SQL Server 2014 came out I rushed to MSDN to download the bits. Because I install SQL Server in my lab all of the time, I decided it was time to build an image with SQL Server already baked in so I wouldn’t loose that much time again and again. Sysprep to the rescue!

What I usually do is build a basic operating system image with all tweaks and Windows Updates included. Then I sysprep that image and use it to build all of my lab machines. But then I have to install SQL Server & SharePoint Server again. That’s not geeky. Geeks are lazy - and so is this one.

To win some time, I prepare a sysprepped image for SQL Server and one for SharePoint Server. Both products support this way of working, as long as you follow the right procedures. That way I end up with a series of images that I can use when needed.

This is how that looks in VMware Workstation:

VMware Snapshot Manager

SharePoint and Sysprep

For SharePoint it’s simple: install all prerequisites, binaries and updates but don’t run the configuration wizard. Sysprep your image and run the configuration wizard after deployment. This support article details what you can do and what not. It’s for SharePoint 2010 in an Azure context, but the same goes for SharePoint 2013 outside of Azure.

SQL Server and Sysprep

For SQL Server the procedure is similar, but not quite. The complete approach is detailed in this MSDN article. You install the SQL Server binaries, but you don’t use the regular wizard to do so. In stead, click “Image preparation of a stand-alone instance of SQL Server” on the Advanced page. When you deploy, you launch the SQL Server Installation Center from the start screen and choose “Image completion of a prepared stand-alone instance of SQL Server”:

SQL Server Installation Center

Then you only have to provide some limited details (serial number, instance name, service accounts,…) and you’re done.

Product key problem

One additional gotcha I encountered was that my original product key was not accepted anymore. That’s strange, as I use the same one when installing without sysprep. As a workaround you can launch SQL Server setup from the ISO file and choose the “Image completion” option from there. It will automatically fill-in your product key for you. After that, it will continue with the bits already installed on your server so you’re not installing again - just configuring. I’m not sure this is a bug or not.