Build development servers for SharePoint using virtual images

It is often very tedious to create and set up SharePoint on one machine, then reproduce the same steps on another machine in another environment over and over again for development and testing. I will briefly discuss two different options, by using virtual servers:

  1. Prepare a fully configured server, then copy it and rename the new server
  2. Prepare a server with all software installed, then copy it and run a script to configure the SharePoint solution

I highly recommend using option 2. For both methods you should use sysprep to prepare the server image to be copied.

Prepare a fully configured server, then copy the image and rename the server

The base image is built with OS, SQL server and SharePoint software. Then configure the SharePoint solution the way you like. Sysprep the server to prepare it for copying.
Now you can copy the image to create a new development server. After the machine has started you must start to rename the server. Follow the steps in this blog post  http://www.sharepointblogs.com/mirjam/archive/2007/08/06/renaming-a-moss-server.aspx
Be aware that you might encounter some issues with this method and can be required to start over again. I don’t prefer using this method.

The base image is built the same way as the other option, except the SharePoint configuration. The configuration is prepared as a script that is run after the new server has been created.  Sysprep the server to prepare it for copying.
Now you can copy the image to create a new development server. After the machine has started you just run the script.
A good starting point for a script to deploy SharePoint is SharePoint Powershell Deploy, available at www.codeplex.com

How to sysprep for Windows Server 2008

(this part is borrowed from www.ssw.com ) For Windows 2008, the sysprep tool is included as part of the Windows installation. It is located at c:\windows\system32\sysprep\sysprep.exe. However, the setup manager used to create the answer file is replaced by Windows System Image Manager which is part of Windows Automation Kit. This can be downloaded from Microsoft Download Center at http://www.microsoft.com/downloads/details.aspx?FamilyID=94bb6e34-d890-4932-81a5-5b50c657de08&DisplayLang=en.
The following describes the steps taken to sysprep a Windows Server 2008 image:

  1. Download Windows Automation Kit
  2. Install and run Windows System Image Manager
  3. Select the Window image or catalog file for your edition of Windows Server 2008
    Note: catalog file can be found in the Windows Server 2008 DVD under the Sources directory
  4. Configure the Answer file tree with the following settings:
    1. Name, Organization Name, Product Key
    2. Enable automatic generation of Computer Name
    3. Add any Run once or additional commands
  5. Save the answer file to:
    c:\windows\system32\sysprep\unattended.xml
  6. Run sysprep with the following command line:
    sysprep /generalize /oobe /shutdown /unattend:sysprep.xml

For more information, see: http://blogs.technet.com/askcore/archive/2008/10/31/automating-the-oobe-process-during-windows-server-2008-sysprep-mini-setup.aspx