This post was originally published here

So you want to sysprep your BizTalk Server 2013 Development Environment? Well this might just be your lucky day. This post will detail the steps required in order for you to create your sysprep BizTalk Server 2013 Development environment.

Update2! Due to several requests; I’ve created a zip file containing all required script files and a document highlighting the required steps in order to sysprep an BizTalk Server 2013 (Standalone) image. You can download it here

Update! I’ve made a small change to the sysprep.xml file; fixing an issue with regards that you had would be prompted to agree with the fact that you were changing the powershell execution policy; it now includes the additional switch -force which will take care of this prompt. Besides this I added an additional script which will remove the product key and will prompt you at then end to enter a new product key. Please note that this last functionality is by default uncommented in the sysprep.xml file

Ingredients

There is actually only one pre-requisite and it consists of the that you have already ‘build’ your own (Single-Server) BizTalk Server 2013 Development Environment; in short a clean, lean and mean VM which contains:

  1. Windows Server 2012 installed and configured
  2. SQL Server 2012 installed and configured
  3. Visual Studio 2012 + updates
  4. BizTalk Server 2013 installed and configured
  5. Other tools you might find handy

In case you don’t have an Environment available or need assistance creating one; I suggest to check out this link which will redirect you to Sandro Pereira BizTalk Blog.

BizTalk Server Un-configuration

This chapter will explain how to export the current BizTalk Server Configuration settings; once these settings have been exported we will proceed with a complete un-configuration of BizTalk Server (Including dropping all BizTalk Databases). If you already know how to do this, feel free to skip this chapter, if not well read on…

1. Start your VM and log on with your Administrator Account

2. Once logged on, press the windows key and once in the ‘ type “BizTalk Server Configuration”, select it and press enter

3. The BizTalk Server Configuration screen will pop up. Now choose the option Export Configuration and save the resulting xml file to your desktop (I named it: BizTalk_Standalone_Configuration.xml)

4. Next step is to unconfigure all installed BizTalk Features. In order to do so click on ‘Unconfigure Features’. Select all features and once done press ok and follow the subsequent instructions displayed

5. Now wait, and once completed press Finish and close the Configuration Wizard

6. Now press the windows key and type ‘SQL Server Management Studio’. Select it and press enter.

7. Now connect to your LOCAL SQL Server using ‘Database Engine’ as Server-Type

8. Expand databases, and notice the databases related to BizTalk

9. Now delete all the BizTalk related databases one by one. This is done by right-clicking on one of the databases

“(in my case: BAMArchive, BAMPrimaryImport, BAMStarSchema, BizTalkDTADb, BizTalkMgmtDb, BizTalkMsgBoxDb, BizTalkRuleEngineDb, SSODB ) “

10. A popup will show ensure you’ve checked the ‘Close existing connections’ checkbox and then press OK which will result in the database removal.

11. Now repeat step 9 and 10 for the other BizTalk databases

12. Now that all databases have been deleted, open the Security folder and it’s Logins folder

13 Now delete all the BizTalk related user groups and accounts one by one. This is done by right-clicking on a group/(service)account and selecting delete

in my case: BizTalk Application Users,BizTalk Isolated Host Users, BizTalk Server Administrators, BizTalk Server B2B Operators, BizTalk Server Operators, SSO Administrators, svc-bts-bam-ws and svc-bts-bre

14 A popup will show press OK which will result in the database removal of the database group or user

15 Now repeat step 13 and 14 for the other BizTalk Groups and Service Accounts

16 Now that all groups and accounts have been deleted, open the SQL Server Agent node and it’s Jobs folder

17 Now delete all the BizTalk related jobs one by one. This is done by right-clicking on a job and selecting delete

in my case: BizTalk Backup Server, CleanupBTFExpiredEntriesJob_BizTalkMgmtDb, DTA Purge and Archive, MessageBox_DeadProcesses_Cleanup_BizTalkMsgBoxDb, MessageBox_Message_Cleanup_BizTalkMsgBoxDb, MessageBox_Message_ManageRefCountLog_BizTalkMsgBoxDb, MessageBox_Parts_Cleanup_BizTalkMsgBoxDb, Monitor BizTalk Server, Operations_OperateOnInstances_OnMaster_BizTalkMsgBoxDb, PurgeSubscriptionsJob_BizTalkMsgBoxDb, Rules_Database_Cleanup_BizTalkRuleEngineDb, TrackedMessages_Copy_BizTalkMsgBoxDb

18 A popup will show press OK which will result in the database removal of the job in question

19 Now repeat step 17 and 18 for the other BizTalk Jobs

20 Now disconnect

21 Now press the connect tab and select Analysis Services and logon.

22. Expand the folder Databases and right click on the BizTalk related Analysis Dbs and select delete

“(in my case: BAMAnalysis)”

23. A popup will show ensure you’ve checked the ‘Continue deleting objects after error’ option and then press OK which will result in the database removal.

24. Now close SQL Server Management Studio

Hacking the BizTalk Export File

This chapter will explain how to manually change the settings in the exported BizTalk configuration file. If you already know how to do this, feel free to skip this chapter, if not well read on…

1. Before you un-configured your BizTalk Server you’ve exported the configuration settings, well now it’s time to open this file and make some modifications to it. Below you will see a ‘Large’ screenshot highlighting the pieces which should be modified and below the image the changes are highlighter per line number. (or alternatively download my exported configuration settings)


Line 12: Set the SSO backup file location
Line 15: Set the Password used to protect the secret backup file
Line 18: Set the Password used to protect the secret backup file
Line 21: Set a reminder for the password

line 27: Should be already filled in with the username used for the SSO Service
line 28: Ensure this field is empty
line 29: Enter the password belonging to the service account mentioned in line 27

line 32: Ensure the Server field contains the value .
line 41: Ensure the Server field contains the value .

line 47: [CREATE OR JOIN BIZTALK GROUP] Ensure that the attribute Default has the value “Create”
line 48: [CREATE OR JOIN BIZTALK GROUP] Ensure that the Answer element contains the attribute SELECTED with value YES

line 50: Ensure the Server field contains the value .
line 57: Ensure the Server field contains the value .

line 73: [CREATE OR JOIN BIZTALK GROUP] Ensure that the Answer Element does not contain an attribute SELECTED

line 94: Should already be filled out with the username used for the NT Service for the In-process Host Instance
line 95: Ensure this field is empty
line 96: Enter the password belonging to the service account mentioned in line 94

line 118: Should already be filled out with the username used for the NT Service for the BizTalk Isolated Host Instance
line 119: Ensure this field is empty
line 120: Enter the password belonging to the service account mentioned in line 118

line 128: Ensure the Server field contains the value .

line 135: Should already be filled out with the username used for the NT Service for the BizTalk Rule Engine
line 136: Ensure this field is empty
line 137: Enter the password belonging to the service account mentioned in line 135

line 143: Ensure the Server field contains the value .
line 150: Ensure the Server field contains the value .
line 159: Ensure the Server field contains the value .
line 166: Ensure the Server field contains the value .

line 175: [BAM ALERTS CONFIG] Ensure that the attribute Default has the value “No”
line 176: [BAM ALERTS CONFIG] Ensure that the Answer Element does not contain an attribute SELECTED
line 195: [BAM ALERTS CONFIG] Ensure that the Answer element contains the attribute SELECTED with value YES

line 197: [BAM TOOLS] Ensure that the attribute Default has the value “No”
line 198: [BAM TOOLS] Ensure that the Answer element contains the attribute SELECTED with value YES
line 199: [BAM TOOLS] Ensure that the Answer Element does not contain an attribute SELECTED

line 204: Should already be filled out with the username used for the NT Service for the BAM Management Web Service User
line 205: Ensure this field is empty
line 206: Enter the password belonging to the service account mentioned in line 204

line 209: Should already be filled out with the username used for the NT Service for the BAM Application Pool Account
line 210: Ensure this field is empty
line 211: Enter the password belonging to the service account mentioned in line 209

2. Once you’ve made the changes, save the file.

3. Now open the BizTalk Configuration Tool

4. Fill out the initial details (Caution: use custom configuration) and once done press Configure

5. Now click on Import Configuration

6. Select the ‘modified file’ and press ok. The configurations will now be imported, and once done you should see a message box stating that same fact

7. Next step is to validate all settings (see screenshots)

8. Now Press Apply Configuration to test if everything works

9. If it worked than hurrah! Now go and un-configure everything once again J (see beginning of this blog-post, yes this includes SQL Server etc..)

10. If it failed, bummer! Well go and un-configure and make modifications to the import file and retry steps 1 till 10

Golden Image

Well we are almost done, however now we need to care of a mechanism which will ensure that our BizTalk can be automagically configured, and for this we will use the all so mighty and sometimes underrated Windows Task Scheduler!

Well the following trick I picked up in this blog-post, and I used the same trick in my last blog-post. This trick involves the following actions which you need to perform

1. Download and unpack this archive

2. Copy the contents to c:Program Files (x86)Microsoft BizTalk Server 2013

3. Create the following directory c:Scripts

4. Download and unpack this archive and copy the contents to the newly created directory c:Scripts

5. No press the windows key, type ‘Scheduled Tasks’ and double click the application

6. The Task Scheduler will now open.

7. From the menu-bar select Action -> Import Task…

8. Now in the file-picker browse to c:Scripts and select the following file to import “BizTalk Configuration Scheduled Task”

9. The scheduled task will open, now click on the button “Change User or Group…:”

10. Enter the administrator user name and press ok

11. Ensure the checkbox “Run with highest privileges” is checked and the administrator user name is used when the task is run and press Ok

12. Now enter the password for the administrator user.

13. Close the Task Scheduler

14. Congratz your ‘Golden Image’ is ready. Now might be a good time to shutdown the server and copy this VHD and store it in a safe place

Sysprep

Now we are ready for our last step, so after you have made a copy of your ‘Golden Image’ it is time to fire-up your VM and perform these last few steps.

1. Once the VM has started and you logged on as Administrator go to c:Scripts

2. Open the sysprep.xml file and make a few changes. Once more I’ve highlighted the lines which require a change.

Line 22: Replace with a valid Windows Server 2012 product Key!
Line 23: Replace with your Organization name
Line 24: Replace with the registered owner
Line 29: Enter the name of your Time Zone
Line 64: Replace with your Organization name
Line 65: Replace with the registered owner
Line 68: Replace with the administrator user password
Line 74: Replace with the administrator user password
Line 80: Replace with the administrator username
Line 99: Replace with the current computer name
Line 125: Enter the name of your Time Zone

3. Now save your file and go back to the c:Scripts directory and click on startSysprep.bat

4. Your image will be SYSPREPPED and once done your VM will shutdown

Enjoy!