How to sysprep SQL Server Express?

We plan to deploy Hyper-V VHD with Windows Server 2008 R2 and SQL Server 2012 Express installed to multiple hosts. From my understanding, the correct way to do this is to install SQL Server in prepartion mode, sysprep Windows, then complete SQL Server installation when the VHD is deployed. I mostly followed the process in this blog post: http://sethusrinivasan.com/category/sysprep/

However, after the VHD is deployed, I'm unable to complete the SQL Server installation. It keeps saying "Upgrade matrix is incorrect". It seems that it's trying to upgrade itself to Enterprise edition (I was asked for product key during install, but I skipped it). Could anyone share their experience in deploying VHDs with SQL Server (we're fine with either SQL Server 2008 R2 or 2012)?

I think the source of my issue is because I can't select "Express Edition" when entering the product key at the completion stage, so the installation is trying to do an upgrade to Enterprise Edition. I have no idea why the drop down list is empty.enter image description here


Solution 1:

Turned out it was caused by the SQL Server setup. After the "prepare" stage, a shortcut to the "complete" stage will be added to the Start Menu. However, for some reason the shortcut links to the SQL Server Enterprise setup. To complete a SQL Server Express prepared instance, the setup must be launched from the SQL Server Express install media, using the command prompt.

To start the prepare stage, use

setup /action=PrepareImage

To complete a prepared instance, use

setup /action=CompleteImage

Hope this helps someone in the future.

Solution 2:

Sysprep is supported for SQL 2012 Express as you can see here:

http://technet.microsoft.com/library/cc645993(SQL.110).aspx

Please note that: You cannot specify Product IDs for a prepared instance of SQL Server Express editions, you cannot upgrade it to other editions and SQL Server tools are not supported for SQL Server SysPrep installations.

http://msdn.microsoft.com/en-us/library/ee210754

For detailed instructions have a look here:

http://msdn.microsoft.com/en-us/library/ee210664

Solution 3:

Your best bet will be to setup SQL Server as part of the sysprep process. SQL Server can be installed via a command line install via parameters as part of the VM's deployment (usually via a batch file).