Unless you’ve only used the newer HTC models with TouchFLO that monopolizes almost your entire today screen you’ve probably noticed the field that provides information about the owner of the device. While entering this info, possibly for time number x after another hard reset of your device, you might have been thinking “it shouldn’t be necessary typing this manually every time”. And in a corporate environment you might want to have a company standard for what goes into the fields so users don’t type in “Owner: Batman, Address: Gotham City”.
And, yes, there is a way to do this in a more automated fashion. I’ll present one option here.
Your first step would probably be guessing that this is stored in the registry – and you’d be right. You’ll find some keys in HKCU\ControlPanel\Owner. (You’ll also find HKLM\ControlPanel\Owner – ignore this key.) Unfortunately it’s not as easy as setting the appropriate key “Name”, etc. You see that binary key called ”Owner” – that’s where you want to insert all the info, and the other keys are derived from this. (“Owner Notes” is the “Notes” tab in the configuration on the device.)
If you double click “Owner” you’ll see a pattern:
![]()
The solution I will show you here is creating a small C# app that will generate an xml-file that can be provisioned to the device. You could add a step that generates a cab-file for you as well, but for automatic deployment you’d also need to sign it. (A step that could also be automated.) What makes more sense for your scenario depends on whether you have a device management solution, and what options this system allows for provisioning. Maybe you just want to generate cabs and distribute to your users for them to run. With a decent device management solution you should be able to get the system to run the application when the device connects for the first time. Without a DM solution it becomes more of an academic exercise.
If you’re not comfortable with C# it can be done with VBScript as well although I find that to be more of a hassle. (You have to create your own Base64-encoding since it’s not included in VBScript.)
The application takes the username of the device owner as a parameter and fetches the rest of the info from Active Directory. So if you don’t have any info in AD, you’ll have to modify the solution to acquire the info from another source.
So first things first – let’s grab that info from AD:
string outputFile = “ownerinfo.xml”; Stream xmlFile = new FileStream(outputFile, FileMode.OpenOrCreate); StreamWriter output = new StreamWriter(xmlFile); String ldapPath = “LDAP://dc/CN=Users;DC=Contoso;DC=com”; DirectoryEntry ldapDir = new DirectoryEntry(ldapPath); ldapDir.AuthenticationType = AuthenticationTypes.Secure; DirectorySearcher ldapSearch = new DirectorySearcher(ldapDir); ldapSearch.Filter = “(&(objectCategory=Person)(objectClass=user)(sAMAccountName=” + sAMAccount + “))”; ldapSearch.SearchScope = SearchScope.Subtree; SearchResult ldapResult = ldapSearch.FindOne();
Yes, call me lazy for not implementing a better solution than hard coding the LDAP path
Create variables for the fields in the User object we care about (obviously it’s recommended you use try-catch for those user objects that turn out to have something missing):
String ownerName = “”; String ownerCompany = “”; String ownerAddress = “”; String ownerPhone = “”; String ownerMail = “”; DirectoryEntry ldapUser = ldapResult.GetDirectoryEntry(); ownerName = ldapUser.Properties["name"].Value.ToString(); ownerCompany = ldapUser.Properties["company"].Value.ToString(); ownerAddress = ldapUser.Properties["streetAddress"].Value.ToString(); ownerPhone = ldapUser.Properties["mobile"].Value.ToString(); ownerMail = ldapUser.Properties["mail"].Value.ToString();
The properties are LDAP properties, and you can find the ones you’re interested in using either ADSIEdit or a suitable LDAP browser.
And this is the part you’ll want to take note of if you want to implement this is VBScript or any other choice of script/language. How to prepare the variables, and create an xml-file containing provisioning xml.
// We need to zero-pad the variable. The numbers are taken from a registry that have been populated // by typing in owner info manually. char pad = (char)0; ownerName = ownerName.PadRight(36,pad); ownerCompany = ownerCompany.PadRight(36,pad); ownerAddress = ownerAddress.PadRight(186,pad); ownerPhone = ownerPhone.PadRight(25,pad); ownerMail = ownerMail.PadRight(34,pad); String ownerTotal = ownerName + ownerCompany + ownerAddress + ownerPhone + ownerMail; //We want Unicode and Base64 UnicodeEncoding ownerByte = new UnicodeEncoding(); Byte[] workArray = ownerByte.GetBytes(ownerTotal); String ownerInfo = Convert.ToBase64String(workArray); // Write to file output.WriteLine(“<wap-provisioningdoc>”); output.WriteLine(“<characteristic type=\”Registry\”>”); output.WriteLine(“<characteristic type=\”HKCU\\ControlPanel\\Owner\”>”); output.WriteLine(“<parm name=\”Owner\” value=\”" + ownerInfo + “\” datatype=\”binary\”/>”); output.WriteLine(“</characteristic>”); output.WriteLine(“</characteristic>”); output.WriteLine(“</wap-provisioningdoc>”); output.Close();
The sample code here isn’t performing any error-checking – so if it isn’t working you don’t get any wiser before you include some sanity checks.
Putting it together to a working sample I fire up the command line, run “BuildOwnerXML andreas” and get a file called “OwnerInfo.xml”. For testing purposes I generate a cab file; “makecab _setup.xml OwnerInfo.cab”. (Renaming the xml-file so it follows the documented format for makecab. Makecab is included if you have Visual Studio installed, but is also available as a separate free download from MS.)
Copy cab to device, run cab, accept warning (it’s not signed), and you’re done!


There are no responses yet