Thursday, October 4, 2012

Windows mobile 6.5 - Using provisioning XML to set owner name

I'm currently working on converting a windows mobile application to run on an Intermec CN50 instead of the Motorola 65.  I've been working on the provisioning process using Intermec SmartSystems and a combination of their custom XML and provisioning XML.  We need the owner name to be the same on every device in order for some of the registered software to work properly.  I wanted to automate this using provisioning xml.  It proved more difficult than I expected as the owner information is stored in the registry in a binary field.  Below is the process to retrieve this and use the provisioning xml to set the binary value correctly. 

1)  Go onto a device and set the desired username. In this example we will use Joe Rep. 

2)  Connect the device to the computer through activesync and open the registry in your favorite mobile registry editor.  I personally prefer Soti PocketController Enterprise.  There is a 7 day trial, but the license is cheap and well worth it for all the features.

3)  Drill down to the HKCU\ControlPanel\Owner key.  You should see the following values:


4)  The Owner value is what we are interested in.  Note that the Name value is a string, but if we just set this value and then go into the control panel it gets overridden by the binary value.  We need to set both for the value to "stick".

5)  Export the Owner key to a .reg file and open in your favorite text editor. 

6)  Find the line that starts with:  "Owner"=hex:.  Copy all the values after hex:  and up to the next key.  Don't worry about removing any of the non hex chararcters or making it a single line.

7)  The provisioning XML requires a base64 encoded string.  We will use the Hex to base64 converter at http://tomeko.net/online_tools/hex_to_base64.php?lang=en.  I like this converter because it removes the extra characters the reg file added for you saving you time cleaning up the data.

8)  Paste the copied hex values into the first text box labeled Hex string and click the convert button.

9)  Select and copy the entire string in the text box labeled Output (base64).

10)  We are now ready to create our provisioning XML.  I always check MSDN to verify my data types.  http://msdn.microsoft.com/en-us/library/gg155033.aspx.

11)  The provisioning xml is below.  Just paste the string into the value and your provisioning XML is ready.

<wap-provisioningdoc>

<characteristic type="Registry">

  <characteristic type="HKCU\ControlPanel\Owner">

    <parm name="Name" value="Joe Rep" datatype="string" />
    <parm name="Owner"  value=""  datatype="binary" />

  </characteristic>

</characteristic>

</wap-provisioningdoc>