Friday 1 July 2011

Windows 7 - Adding additional input languages IME with SCCM or logon script

Automating the process of adding input languages (IME) in Windows has always been convoluted but has got worse with the release of Windows 7.

In some education or enterprise environments it may be critical to deploy images with multiple IME's or perhaps even deploy IME changes to existing computers. There is one easy solution, to add them to your base image, but that is a nightmare in most organizations where the goal is consolidation.

The logical solution is to use the unattend.xml functionality of Windows and deliver the IME's as part of the deployment of the OS, again this has problems. Users have reported using unattend.xml to deliver IME's such as Chinese PRC Pinyan and end up getting Chinese with a US keyboard, which is useless for inputting Chinese characters.

The solution lies in the command line functionality of the intl.cpl, which is the control panel applet that looks after the region settings, by using a specially crafted xml file we can pass the IME's we want to the OS during the build process and include them in the default user profile. Alternatively we could deliver these settings retrospectively to users via a logon script.

For my systems I want a default IME of en-US and a Chinese PRC Pinyan IME as an option for my users. Here is the XML file I produce to achieve this.


XML File Example



<gs:GlobalizationServices xmlns:gs="urn:longhornGlobalizationUnattend">
<gs:UserList>
<gs:User UserID="Current" CopySettingsToDefaultUserAcct="true" CopySettingsToSystemAcct="true"/></gs:UserList>
<gs:InputPreferences>

<!--en-AU--><gs:InputLanguageID Action="add" ID="0c09:00000409" Default="true"/>

<!--chinese pinyin--><gs:InputLanguageID Action="add" ID="0804:{81D4E9C9-1D3B-41BC-9E6C-4B40BF79E35E}{F3BA9077-6C7E-11D4-97FA-0080C882687E}"/>

</gs:InputPreferences>

</gs:GlobalizationServices>


You can see in the above code that the en-AU IME is set to default while the Chinese Pinyan IME is simply added.This XML file copies these two languages to the system account and to the default user profile. Alternatively you may want to call this via a logon script for a non-privledges user, in which case you should change the CopySettingsToDefaultUserAcct and CopySettingsToSystemAcct variables to "false"

You could add an number of IME's to this XML file, all you need is the InputLanguageID. These can be tricky to work out, but by the help of these two links you should be okay.

For most input languages you can simply refer to this MSDN post titled Locale IDs, Input Locales, and Language Collections for Windows XP and Server 2003. Yes it does say for Windows XP but these also apply to Windows 7.

Some Asian languages such as Chinese break these rules slightly (as you can see above with my enormous GUID style IntputLanguageID. You can refer to this alternate MSDN article titled From KLID to GUID for the InputLanguageID's of these languages.

As with my XML example above it is totally acceptable to mix and match the use of simple and complex InputLanguageID styles.

Once you have created your XML file you need to call it with the control panel init.cpl applet. As I am deploying this as part of my SCCM task sequence, I first copy the file to a location on the computer that I know exists, then execute the script, my batch file reads as follows.

Batch File Example

copy chineseprc.xml %windir%\temp\chineseprc.xml /Y
control.exe intl.cpl,,/f:" %windir%\temp\chineseprc.xml"


Hopefully this can help side-step the heartache that I felt while trying to add additional IME's to my Windows 7 machines without adding them to the default image.