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 ..
.. 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
<p>Mark Russinovich has discontinued NewSID from sysinternals and he said machine SID duplications won't be a problem.</p>
<p>He even said sysprep will be update to skip SID generation.</p>
<p>I know sysprep has some advantages, but I never used it to regenerate SID (usually because I'm to lazy...). I do a lot of VHD and VM copy and have never had a problem with duplicated SIDs...</p>
<p>You may well be right and I would defer to Mark on anything sysinternals. However sysprep does a bunch of other things too like removing the license key, so this technique will have other uses possibly for preparing demos.</p>
<p>If your VMs are not part of a domain you won't have a problem, but you can't add 2 servers with the same SID to the same domain. At least that's what I've experienced.</p>