Monthly Archives: September 2013

MDT 2012 LTI Deployment, Regional and Locale settings based on #chars of Hostname

Published / by Rens Hollanders / 12 Comments on MDT 2012 LTI Deployment, Regional and Locale settings based on #chars of Hostname

Recently I have done an MDT implementation for a customer regarding a deployment which featured an database of approx. 250 clients, each with known mac-addresses and host-names available to make use of.

The customer requested that based on mac-address the host-name would be provided, and based on the host-name, Regional and Locale settings could be set during LTI deployment. After a little bit of consult on technet and talked to deployment artist ‘Johan Arwidmark’, I’ve incorporated a custom ‘user exit’ script that does just the trick!

Basically, the company had 5 different affiliate locations in 5 different countries, with each different Regional and Locale settings

The script created/used was a joint effort between a colleague and me, (thanks Roger the Young aka. Drillsergeant):

Explanation of script:

The first 4 lines is our basic UserExit script function, the second function retrieves the CountryCode, and retrieves this information based on the first two characters of the host-name. Last, if no value is declared, the script will automatically fill-in the desired default country, which in our case is NL – Netherlands

The script then executes, and replaces the following values, with the values that are specified in the customsettings.ini:

Make sure you add the following properties to your customsettings.ini: “ByCountry“, “CountryAbbr” (which stands for Country Abbreviation) and define the custom properties: “CountryAbbr“, “CountryOU” as your custom declared properties. This way the script knows what to process.

The values I then had declared were:

CountryOU: since they had different OU’s for each country
CountryOrRegion: Country#
InputLocale: specifies the input language and keyboard layout for a Windows installation.
KeyboardLocale: specifies the input language and keyboard layout for a Windows installation.
UserLocale: specifies the per-user settings used for formatting dates, times, currency, and numbers in a Windows installation.
TimeZoneName: gets the Notification Services assigned name for the time zone

This way, the default values will be overwritten with the values that matches the hostname’s first two characters and the values will be placed in your unattend.xml, which is located in the “C:\Windows\Panther”, during the inital setup of the operating system, just after the image has been applied.

If all fails, you’ll notice immediately because then you will find an error during the setup phase of your operating system, which will look like this:

figure 1.1: Unattended.xml parsing error


This indicates that an incorrect value has been written into the unattend.xml, likeley in the <specialize> pass, you can look this up by opening the unattend.xml with notepad during your deployment.


You can just use any country abbreviation that is out there, accompanied by the default settings for this country, or off-course your own values, and also, extend the list of values with other country related settings you wish to apply.

Download the script here: