BizTalk Server 2010: Preparing server with Sysprep
Overview
The System Preparation (Sysprep) tool prepares an installation of Windows for duplication, also called imaging, and enables you to capture a customized Windows image, or "golden image", that can be reused throughout an organization.
This can be particularly beneficial when provisioning machines for a team of BizTalk developers. Installing and configuring BizTalk Server machines from scratch increases the lead time on a project. The other main advantage is the guarantee that each developer is working off a consistent configuration reducing the chances of "it works on my machine" incidents.
However, Sysprepping a BizTalk Server image is not as straightforward as Sysprepping a base Operating System image; mainly due to BizTalk Servers reliance on SQL Server.
BizTalk Server ships with some sample Sysprep scripts, but as with most samples these just serve as a foundation and require some customizations and additions. The documentation that accompanies the sample scripts is misleading in places and contains some gaps that can cause confusion.
This article will cover the steps required to Sysprep a fully configured BizTalk Server 2010 virtual machine. The same steps can be followed for BizTalk Server 2013.
Golden Image
The "golden image" is an isolated virtual machine configured with:
- Windows Server 2008 R2 Standard Edition
- SQL Server 2008 R2 Enterprise Edition
- BizTalk Server 2010 Enterprise Edition
- Enterprise SSO
- BizTalk Runtime
- Business Rules Engine
- BAM Tools
- BAM Alerts
- BAM Portal
- BizTalk Server 2010 ESB Toolkit
- Exception Management
- ESB Core Components
- Visual Studio 2010 Premium Edition
Steps
Install and configure the software listed above using local accounts and groups.
Prerequisites
There are a number of modifications that should be made post-configuration and pre-sysprep that will reduce the changes required during Sysprep as well as the complexity of the scripts.
These are:
Grant the "Network Authority\System" account sysadmin access on SQL Server.
Modify the URL of the "BAM Portal Web Site" shortcut under All Programs, replacing the computer name with "localhost".
Modify the service account on each of the services that are configured to run under a local user, replacing the computer name for "."
Modify the service account on each of the application pools that are configured to run under a local user, replacing the computer name for "."
Modify the URI of the All.Exceptions send port in the Microsoft.Practices.ESB application, replacing the computer name with "(local)"
Modify the server name in the BAM SSIS packages, replacing the computer name with "(local)". To do this follow the steps outlined in this MSDN article http://msdn.microsoft.com/en-us/library/aa548024.aspx
Note: Although EDI has not been configured in our "golden image" it is worth noting that the URI of the BatchControlMessageRecvLoc and ResendReceiveLocation receive locations in the BizTalk EDI Application should be changed to use "(local)" instead of the computer name.
** Important: Before continuing any further ensure the master secret has been backed up **
Scripts Preparation
The following changes are required to the scripts before they can be run:
Unattend_Win2K8x64.xml
Modify the lines in the file identified with "!" before them:
- ComputerName - Use "*" to generate the computer name or enter a value to specify a static name
- ProductKey - Enter a valid product key for Windows Server 2008 R2
- RegisterOrganization - Specify the organization the machine belongs to
- RegisteredOwner - Specify the name of the person who owns the machine
- TimeZone - Select the time zone where the machine is located. See http://msdn.microsoft.com/en-us/library/ms912391(v=winembedded.11).aspx for a list of available of time zone values
- RegisterOrganization - Specify the organization the machine belongs to
- RegisteredOwner - Specify the name of the person that owns the machine
- AdministratorPassword/Value - Enter the password for the administrator account
- AutoLogon/Value - Again, enter the password for the administrator account to facilitate auto logon
- Username - Specify the username of the administrator account
- $(OLDCOMPUTERENAME) - Replace all instances of this value with the current computer name
- TimeZone - Select the time zone where the machine is located
Note: This article does not cover joining a domain, as a result the "Microsoft-Windows-UnattendedJoin" component has been commented out as has the "Domain" element of AutoLogon.
UpdateInfo.xml
Replace all instances of $(OLDCOMPUTERENAME) with the current computer name.
RestoreMasterSecret.cmd
Replace $(MASTERSECRETBACKUPPATH) with the path to location of the master secret backup file.
UpdateSqlServerAndInstanceName
Replace all instances of:
- $(BIZTALKSERVERSERVICEACCOUNT) with the name of the service account BizTalk Server was configured with
- $(BIZTALKSERVERSERVICEACCOUNTPASSWORD) with the password of the BizTalk Server service account
Note: This script will only need to be modified for BizTalk Server 2010 and BizTalk Server 2013 configurations that use SQL Server 2008 R2. BAM Alerts does not require Notification Services in SQL Server 2012 and doesn't need to be re-registered as a result5.
UpdateSqlSecurity.cmd
Replace all instances of:
- $(BIZTALKSERVERSERVICEACCOUNT) with the name of the service account BizTalk Server was configured with
- $(SQLSERVERSERVICEACCOUNT) with the name of the account SQL Server runs under
Note: As this is an isolated development VM the BizTalk Server and SQL Server components have been configured with single accounts. If separate accounts have been used the UpdateSqlSecurity script will need to reflect this.
SetupComplete.cmd
Replace all instances of $(OLDCOMPUTERENAME) with the current computer name
Sysprep
Having prepared all the scripts the Sysprep process can now be executed.
Copy the SetupComplete.cmd file to the %WINDIR%\Setup\Scripts\ folder
Open a command prompt and run the following command :
C:\windows\system32\sysprep\sysprep.exe /oobe /generalize /shutdown /unattend:c:\scripts\unattend_Win2K8x64.xml
The virtual machine will automatically shut down once Sysprep is complete
Move the virtual disk to a safe location. This is the master image that will be cloned for future VMs
Clone
Once the Sysprep process is complete and the master image is placed in a safe location a clone of the VM is created.
- Copy the virtual disk
- Create a new VM and attach the copied virtual disk
- Start the VM
- The unattend_Win2K8x64.xml file is used to configure Windows during this stage
- The configuration will pause towards the end of the process and a command prompt will be displayed requesting a password is entered. This is the password associated with the master secret backup file. Enter it and press return
- Once the configuration completes the VM is ready to use
Considerations
- On the cloned VM there will be some inconsistencies between the settings in the BizTalk Server Configuration tool and the actual configuration of VM, mainly for BAM.
This will also be the case for the ESB Configuration tool.
Both configuration tools can be ignored and should no longer be required as the VM has been configured. Should any configuration changes be required in the future the wizards can still be used, or in the event of any issues a variation of the scripts used to Sysprep the VM could be used.
- Another hangover from changing the server name is that the schemas created during the BizTalk Server configuration will remain. Renaming a schema is not possible, it requires a new schema to be created and ownership transferred from the old schema to the new one. As this does not cause any issues and is just cosmetic it has not been addressed in the scripts.
- While the manual steps under Pre-requisites are "once-offs" they should be automated also.
Common Errors
The following issues are the most likely to occur during the process and are worth highlighting.
- Windows could not parse or process the unattend answer file for pass [specialize]
The root cause of this error was an invalid product key for Windows Server 2008 R2
NOTE: another cause of this error was an old user who no longer existed ...
- solution was to deleted any details from ... HKLM\Software\Microsoft\Windows NT\CurrentVersion\ProfileList
- The drive letter changes on secondary drives.
This issue will occur on configurations where BizTalk Server is installed on a drive other than C, for example E. During Sysprep the drive letter changes from E to D causing all scripts to fail due to the path to BizTalk Server on the E drive no longer being valid.
The following steps are required to resolve this:
Export the HKEY_LOCAL_MACHINE\System\MountedDrives key from the registry
Use the /quit switch when running Sysprep to prevent the VM from restarting automatically
C:\windows\system32\sysprep\sysprep.exe /oobe /generalize /quit /unattend:c:\scripts\unattend_Win2K8x64.xml
Once Sysprep completes, import the key to the registry
Shutdown the VM
Downloads
All the scripts used in this article can be download here:
Technical Reviewers
We would like to thank the following persons who reviewed this article:
See Also
Read suggested related topics:
Another important place to find a huge amount of BizTalk related articles is the TechNet Wiki itself. The best entry point is BizTalk Server Resources on the TechNet Wiki