SQL Server 2008 R2 image preparation

With the rise of the virtual machine, the quick creation of a sandbox in which developers and testers can work without fear of compromising the production environment becomes a much simpler exercise. You will see built in support for this lab management in the ultimate edition of Visual Studio Team System (VSTS) through the use of System Center Virtual Machine Manager (SCVMM).

One of the problems posed by these sorts of operations is that while it is easy to make a copy of a machine , be it physical or virtual, it’s a bit more difficult to change its identity. While you can quickly change the name of a machine you need to sysprep it to change it’s unique Security Identifier (SID). SID’s are how active directory identifies individual machines so you can’t have two on the same domain even if they have different names.

This gets more annoying when you include SQL Server in the mix. If you rename a machine that’s running SQL Server or sysprep it, it will upset the SQL Server permissions service accounts etc.  There are workarounds for this but they are tricky and not supported.

However If you use the advanced installation options in

SQL Server 2008 R2 ..

image 

.. you can prepare an image of SQL Server which will survive a sysprep and subsequent domain join.  One you have done that you can come back to this interface and complete the install.  That’s a very manual process so what’s useful is to script all of that.  I have a separate step by step cook book to show you how to do this.

I have also posted a video on TechNetEdge so you can watch me do it (I have compressed down the installation so it only lasts 10 minutes).

The real power of this process comes into its own when you use it with a deployment technology such as Windows Deployment Services (WDS), System Center Configuration Manager (SCCM) or SCVMM as both of these allow you to run scripts as part of the deployment process, thus fully automating it. This is a topic in it’s own right which I will cover later.

To summarise SQL Server 2008 R2 is now sysprep friendly and you can try this out by downloading the November CTP