How to customize the MDT database and... the Workbench

New post for a while, April was quite busy supporting customers... Among several posts I have in draft, this one is quite interesting (from my point of view !) and I wrote it down as soon as I was able to make it works... before I leave for 2 weeks off.

Well, I did not see many people having a customized MDT database that can be provisioned through the Workbench... That's touchy in essence and weird... but we can do it.

As the source code of Microsoft Deployment 2008 has now been publicly released, some of you may want to customize far further the database and provide additional personalization during deployment. This should be possible by using the following step by step.

My first concern was the ability to define static IP addresses when I'm deploying servers. Except by using the Task Sequence and use the predefined task Apply Network Settings (you have to provision with static configuration and not dynamic one), there's no way to do that natively.

My goal was to add the IP Address, the Default Gateway and the Subnet Mask in the database and be able to provision them through the Workbench. Thus I would like to retrieve this information during the deployment and use them to configuration my target machine with...

And last... excuse me if I use some words that do not correspond to the development syntax... I'm not a developer, and I can confirm as one of my teammates helped me a lot around .NET compilation (this guy is really huge !).

Requirements

The requirements are :

You also need to have MDT 2008 installed somewhere...

In Visual Studio 2005

Project signature

As some of the components of the MDT will be rebuild, on some systems the signature of DLL or snapins must be signed. We don't have the original key so we'll create our.

  1. Create a “Keys” folder in the installation folder (e.g. “C:\Program Files\Microsoft Deployment Toolkit 2008 Source\Keys”).
  2. Using a “Visual Studio 2005 Command Prompt”, navigate to the created directory and execute the command “sn.exe -k Microsoft.BDD.snk”. This will create the strong named key needed for compiling the managed code assembly projects.

image

 Test compilation

  1. Open Visual Studio 2005

  2. Open the project Workbench ("C:\Program Files\Microsoft Deployment Toolkit 2008 Source\Workbench\Microsoft.BDD.Workbench.sln")

  3. It should open the Workbench project as well as all dependencies :

    image

  4. From the Build menu, select Rebuild Solution

  5. If there are some errors related to references in the project, look at missing or incorrect references and replace them with the correct DLLs

  6. It should rebuild all DLLs in the folder ..\..\..\..\Program Files\Microsoft Configuration Manager Console\AdminUI\bin\

Add customization

  1. In the project Workbench, open the code for DatabaseDetails.cs and add the following code at the end, after the section SkipBitLockerDetails :

    [Category("Wizard Control"), Description("Skip the BitLocker details pane")]
    public String SkipBitLockerDetails
    {
      get
      {
        return theRow["SkipBitLockerDetails"].ToString();
      }
      set
      {
        theRow["SkipBitLockerDetails"] = value;
      }
    }

    /// <summary>
    /// Custom data
    /// </summary>

    [Category("TCP/IP Configuration"), Description("TC/IP Address #1")]
    public String OSDAdapter0IPAddressList
    {
      get
      {
        return theRow["OSDAdapter0IPAddressList"].ToString();
      }
      set
      {
        theRow["OSDAdapter0IPAddressList"] = value;
      }
    }

    You can add all the custom data you want like described for the OSDAdapter0IPAddressList...

  2. Rebuild the solution.

In Windows Explorer

Copy the following files from the build directory (..\..\..\..\Program Files\Microsoft Configuration Manager Console\AdminUI\bin\) to the MDT installation directory : C:\Program Files\Microsoft Deployment Toolkit\Bin (be sure to have a backup copy of the replaced files):

  • Microsoft.BDD.Actions.dll
  • Microsoft.BDD.ConfigManager.dll
  • Microsoft.BDD.SCCMActions.dll
  • Microsoft.BDD.Wizards.dll
  • Microsoft.BDD.Workbench.dll

In the Registry Editor

As we rebuilt the Microsoft.BDD.Workbench.dll, the signature has changed and so the registered SnapIn does not reflect the changes.

Locate HKLM\Software\Microsoft\MMC\SnapIns\FX:{FFB8695A-66B4-4929-ABB6-15CB8BD2AE3D} and edit the Type value and replace the strings in bold by the reference of the rebuilt DLL :

Microsoft.BDD.Workbench.PropertySheetSnapIn, Microsoft.BDD.Workbench, Version=0.0.0.0, Culture=neutral, PublicKeyToken=b5c6490be595e62f

image

You can retrieve the PublicKeyToken with .NET Reflector :

image

In SQL Server Management Studio

  1. Add the fields you defined in the DatabaseDetails.cs in the dbo.Settings table :

    image

  2. Modify the view dbo.ComputerSettings :

    image 

    Verify that the new fields are selected and save this view...

In the Workbench

There is nothing to modify in the CustomSettings.ini as the variables OSDAdapter0IPAddressList and so on are already known variables (look at the ZTIGather.xml located in the Scripts folder) but you have to define fake variables in the task Apply Network Settings to make the Lite Touch process identifies the target machine has TCP/IP configuration to set :

image

You can now add the value through the Workbench :

image

If you plan to add custom data that are not already represented by a known variable, you will have to add it to the CustomSettings.ini :

[Settings]
Priority=...
Properties=MyCustomData1, MyCustomData2, ...

Isn't that cool ?

But remember that this kind of customization is quite heavy and will require a redo when you will update to next versions of MDT... and this will also not be "fully" supported (as usual, Microsoft Support never leaves you alone and provides "Best Effort" support at least).

Note that this post is provided "as is" with no warranty nor supportability engagement. It does not engage Microsoft at all.
Nevertheless if you consider this not clear, incomplete or inadequate, please let me know !