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 :
- Microsoft .NET Framework 2.0
- Microsoft Management Console (MMC) 3.0 (be sure to select the corresponding version for your OS)
- Microsoft Windows Automated Installation Kit (Windows AIK) 1.1
- Microsoft Windows Software Development Kit for Windows Vista and .NET Framework 3.0 Runtime Components (Windows Vista SDK)
- Note : During installation, ensure that the 64-bit components are installed if you plan to build executables and assemblies for the x64 platform.
- Microsoft Visual Studio® 2005
- Note : During installation, ensure that the 64-bit components are checked (optional by default). The 64-bit components are required if you need to build the executables and assemblies for x64 platform.
- Microsoft Deployment Toolkit 2008 Source Code
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.
- Create a “Keys” folder in the installation folder (e.g. “C:\Program Files\Microsoft Deployment Toolkit 2008 Source\Keys”).
- 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.
Test compilation
Open Visual Studio 2005
Open the project Workbench ("C:\Program Files\Microsoft Deployment Toolkit 2008 Source\Workbench\Microsoft.BDD.Workbench.sln")
It should open the Workbench project as well as all dependencies :
From the Build menu, select Rebuild Solution
If there are some errors related to references in the project, look at missing or incorrect references and replace them with the correct DLLs
It should rebuild all DLLs in the folder ..\..\..\..\Program Files\Microsoft Configuration Manager Console\AdminUI\bin\
Add customization
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...
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
You can retrieve the PublicKeyToken with .NET Reflector :
In SQL Server Management Studio
Add the fields you defined in the DatabaseDetails.cs in the dbo.Settings table :
Modify the view dbo.ComputerSettings :
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 :
You can now add the value through the Workbench :
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 !
Comments
Anonymous
January 01, 2003
The comment has been removedAnonymous
January 01, 2003
PingBack from http://explorer.wawblog.info/?p=6996Anonymous
May 29, 2008
Joli Guillaume ;) ca me rappelle un peu ca http://blogs.msdn.com/dsebban/archive/2007/07/16/modifications-du-workbench-bdd-2007-ajout-d-un-champ-personnalis-dans-la-base-de-donn-es.aspx :) mais c'est vrai que ton article est vraiment très complet.Anonymous
October 06, 2008
The comment has been removedAnonymous
January 09, 2009
Hi, Wouldn't setting OSDAdapterCount remove the need for a fake entry in the TS? AndersAnonymous
March 09, 2009
a great option to replace this same functionality is webservices. i believe there are more posts on this or Shuffs blogs about utilizing them. Gives you a global replacement without having to rebuild your modifications every time a new MDT release hits the shelf -Dustin