The dynamic computer naming process outlined uses integration points and the ability to run something called UserExit scripts which allows for the extension of the MDT inbuilt logic. The UserExit script will dynamically build the computer name. The computer name generated by the UserExit script will be based on a location ID (two or morecharacters added as a custom property in MDT Deployment Database), the computer chassis typed (L for laptop, W for Workstation, V for Virtual and X if the chassis cannot be identified), and the first 7 characters of the computer serial number (removing spaces and replacing them with minus (-) for situations where the serial number contains spaces such as virtual machines serial numbers). These three properties are then glued together and provided as the OSDComputername variable for use in the deployment process so the computer name will look like: UK (location ID) L (Chassis ID) 1234567 (Serial Number ID).
Steps to follow to achieve this.
1) Create a new property in the MDT Deployment Database (for the location ID).
2) To add a custom property to the MDT Deployment Database we need to edit this table.
Open the MDT Deployment Database() using SQL Management Studio and navigate to the dbo.Settings table
3) At the bottom of the column list create a new column called LocationID and set the data type to nvarchar(10) – this will give you a field of up to 10 characters (you may want to limit this to two or three characters in production depending on the naming convention you use and how many letters represent location).
4) Save the settings to the database (using the save icon on the toolbar in SQL Mgmt Studio)
–it will not be visible in the MDT database interface (within the MDT Workbench) until a query
is run. Execute the following stored procedures.
EXECUTE sp_refreshview ‘[dbo].[ComputerSettings]’
EXECUTE sp_refreshview ‘[dbo].[LocationSettings]’
EXECUTE sp_refreshview ‘[dbo].[MakeModelSettings]’
EXECUTE sp_refreshview ‘[dbo].[RoleSettings]’
5) The new LocationID entry point should now be visible on all of the tables in the MDT Deployment Database viewed through the Advanced Configuration\Database node in the MDT Workbench
– the LocationID entry point will be at the bottom of the form in the Custom area. Now create a new record in the locations table based on Companies networks default gateways – include any location specific settings such as locale, keyboard and time zone andthen add location ID to the new LocationID column.
6) The following settings have been applied to achieve the Dynamic Naming and OU Placement. Right Click on Locations under the Database option and select New.
7) Enter the Location Name and the Gateway IP For that Location.
8) Click on the Details Tab and scroll to the Domain and Workgroup Section. Enter the details as
9) Scroll to User Data Location and enter the Details exactly as shown.
10) Scroll down to the Custom Section and enter the LocationID for the particular location.and click on Ok.
11) Now that the MDT Deployment Database has the location part of the computer name that is
needed. Now it is required to configure the CustomSettings.ini file to query the MDT Deployment Database, store the custom property added and run the UserExit script to glue the LocationID gathered from the MDT database to a chassis ID and the adapted serial number.
12) To Configure the CustomSettings.ini rules right click the database node in the MDT Workbench and select the Configure Database Rules wizard. This wizard will create the queries for each of the tables in the MDT database.
13) Deselect the options in the COMPUTER options and click next. On the LOCATIONS options, adjust so that only the first two options are ticked
14) Deselect all of the queries on the MAKE/MODEL options and the ROLE options and click through to the end and select Finish. This will update the CustomSettings.ini file stored in the
Control folder of the deployment share – open this folder and open the CustomSettings.ini file. It should look like the example below with the MDT Deployment Database queries added
15) Now as the rules are ready we need to add the following details in the Customsettings.ini file to generate the Name.
Priority=CSettings, CPackages, CApps, CAdmins, CRoles, Locations, LSettings, LPackages, LApps, LAdmins, LRoles, MMSettings, MMPackages, MMApps, MMAdmins, MMRoles, RSettings, RPackages,RApps, RAdmins, BuildComputerName, Default
Properties=MyCustomProperties, BuildComputerName, LocationID
This file is to be replaced with the CustomeSettings Package
Now as the database is ready a reference Windows 7 Machine is required to capture it and add in
the SCCM operating System Images node. For this purpose Microsoft Deployment toolkit will be