Microsoft Deployment Toolkit–Hydrating ConfigMgr Secondary Sites with MDT Lite-Touch
The following solution(s) are provided as-is without any warranty, confers no rights and is not supported by the Author(s). Use at your own risk.
Installing and configuring Configuration Manager Secondary Sites is often a manual and time consuming task. If you have 50 or more sites that can be a significant amount of time spent installing and configuring Secondary Sites. The Hydration approach attempts to resolve that issue by providing an automated way to setup and configure Secondary Sites.
The following Hydration solution can be run on an existing Server 2003 or Server 2008 R2 Operating System and will configure the necessary pre-requisites and install the Configuration Manager Secondary Site.
This document assumes the following:
· You have Microsoft Deployment Toolkit 2010 Update 1 installed
· SQL is configured to allow Named Pipes
· You have already created a SQL$ share
· You have the knowledge required to work within the MDT Deployment Workbench
The Hydration process has been tested on Server 2003 R2 SP1/SP2 and Server 2008 R2 SP1.
The files are contained in a “HydrationShare.zip” archive. Once these files are extracted, you will need to modify a few of the script files and add the required source files. This section details those required changes.
The files are provided as a self-contained DeploymentShare. You can simply extract this archive out and open the folder with the Deployment Workbench.
Sources files are required for the following items under the Applications directory in the HydrationShare.
Table 1: Required Source Files
| Folder | Description |
| \ConfigMgr 2007 R3\Source | R3 installation files |
| \ConfigMgr 2007 R3\Hotfix | R3 Pre-req hotfix 977384 |
| \ConfigMgr 2007 SP2 Secondary\PreReqs | ConfigMgr downloaded preq-reqs’s |
| \ConfigMgr 2007 SP2 Secondary\Source | ConfigMgr installation files |
| \ConfigMgr 2007 Toolkit V2\Source | ConfigMgr Toolkit MSI |
| \ConfigMgr Server 2003 IIS\i386 | I386 directory from Server 2003 media |
Extract the HydrationShare.zip archive to the location you want the HydrationShare to reside.
Once the files are extracted out, you need to share out the HydrationShare. A Hidden share is recommended.

1) Open the Deployment Workbench
2) Right-click on Deployment Shares and select Open Deployment Share
3) Select the path for the extracted HydrationShare files
4) Select Next
5) Select Next
6) Select Finish
This Hydration solution relies on a “SCRIPTSITECODE” variable. This solution was developed around this information being populated in the MDT database. It is possible to configure and set this variable through other methods, but this guide will not address those.
1) Open the MDT workbench and expand the HydrationShare.
2) Select Advanced Configuration-Database
3) Right-Click on Database and select New Database
4) Input the name of the SQL server and make sure the Network Library is selected to Named Pipes, then select Next

5) Input MDT2010 for the Database Name and select Next

6) Input SQL$ for the SQL Share, then select Next
7) Select Next
8) Select Finish
Provided with the Hydration files are 2 SQL files for extending the MDT database with the SCRIPTSITECODE value and refreshing the views.
Open the “create scriptsitecode.sql” in SQL Management Studio.
Ensure that you are pointing to the MDT database.

Once you are pointed to MDT Database. You can Execute the query.
You should see “Command(s) completed successfully”

Next open the “refresh MDT views.sql” and make sure you are again pointed to correct database.

You should see “Command(s) completed successfully”
![clip_image013[1] clip_image013[1]](http://myitforum.com/cs2/blogs/cnackers/clip_image0131_thumb_26ECFFEB.png)
If you open up the MDT workbench, go into Advance Configuration – Database- Computers, you will now see a new property called ScriptSiteCode listed on the Settings tab.

A PowerShell script and CSV file are provided for the bulk import of computers into the MDT database. These computers are the servers we want to configure as Secondary Sites.
The CSV file contains the Description, MacAddress, and ScriptSiteCode values we want to import into the Database.

We use the MacAddress to identify the server and configure the appropriate SiteCode for the ConfigMgr installation. The SiteCode is stored in the ScriptSiteCode variable. The description is just a friendly name so we can identify the server in the database.
The provided PowerShell script will do a bulk import of the CSV file into the MDT database. The PowerShell script imports a MDT Module, connects to the MDT database and imports the information from the CSV file.
Edit the PowerShell script to make sure the paths are correct to the source files.

Edit the PowerShell script to make sure the correct SQLServer and Database are specified.

After running the import, you will see the records in the Database based on the information in the CSV.


Once you have opened the HydrationShare with the Deployment Workbench and created the MDT database, there are a few changes that need to be made for the HydrationShare to successfully work.
Under the main HydrationShare properties, make sure the share name is correct and the local path is correct for the location you have put the HydrationShare.

Under the Rules tab, make sure your [CSettings] section has the correct SQLServer and Database name.

Ensure your bootstrap.ini has the correct DeployRoot value.

Under the Rules tab, configure the AdminPassword value to match the local administrator password of the servers you will run the Task Sequence on. This allows the Task Sequence to automatically log in and continue after the required reboots. This is required for the auto-logon to work correctly.

After making the required changes, right click on the HydrationShare and select Update Deployment Share.

Select Next.

Select Next.

Select Finish.

There is a section of code in this script that allows you to specify existing source files to use, if we can find those, we will use those to install ConfigMgr, otherwise we’ll use the files from the script source files directory.
The following code would need to be changed in the script to match the location you might have local source files. It is located at line 93 in the script.
sFile = "F:\folderpath\smssetup\bin\i386\setup.exe"
There is also logic in the 2003 IIS script that checks for a local copy of the i386 directory. We look for the i386 directory at the root of the C: drive. If we don’t find it then we copy it down from the source files. In addition we set a few registry keys to let Windows know where the source files are located. If you wanted to change this location, you would need to modify the following lines of code.
Line 57 – Check for local i386
sFile = "C:\i386\setup.ex_"
Lines 70-72 – Update registry to point to C:\i386
oShell.RegWrite "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup\SourcePath", "C:\", "REG_SZ"
oShell.RegWrite "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup\ServicePackSourcePath", "C:\", "REG_SZ"
oShell.RegWrite "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SourcePath", "C:\", "REG_SZ"
The sender creation script is coded to the primary site. This will need to be modified to point to your primary site.
Lines 51-52
primSiteCode = "001"
primSite = "2008-configmgr"
Server 2003:
· None
Server 2008 R2:
· UAC is disabled
· Server Manager is not configured to start (R3 will fail if it detects any open MMC)

· Script is launched with administrative rights (careful of “Run” credentials)
The Task Sequence can be started by launching the Lite-Touch process from the Run box.
Use the following command:
“Cscript.exe \\servername\hydrationshare$\scripts\litetouch.wsf”

Once started, you will see the Task Sequence selection screen, select Next to continue.

On the credentials screen, provided an account that has appropriate credentials to connect to the HydrationShare. (Read Acces)

After clicking Next, the process will start. (Example screen from 2008 R2)

Download the HydrationShare here.