Identifying an Enterprise Chrome Device

We have a specific requirement at work to be able to identify a machine’s host name and pass that through to a telephony solution which then associates that machine with a specific telephone number. At the moment we have a Windows script to do it but obviously this won’t work on a Chrome device…

I did some research and found that there is an API available if the Chrome device is enrolled and the extension or application has been pre-installed onto the device by the policy in the Admin Console:

https://developer.chrome.com/extensions/enterprise_deviceAttributes

If the enterprise_deviceAttributes API is available you can call the DirectoryDeviceId method to return the unique Id associated with the device.

Although I’m not a developer by a long stretch I cobbled together the following code as “background.js” which is launched by clicking on the extension.

chrome.browserAction.onClicked.addListener(function(tab) {
var asset_id = "Debug_Start";
//Check if enterprise deviceAttributes are available on the machine
//Needs to be an enrolled machine with this extension pushed from
//the Admin Console by and admin
if (chrome.enterprise.deviceAttributes) {
//Set a temporary value for the device id
asset_id = "Debug_GettingId";
//Attempt to retrieve the Directory Device Id
chrome.enterprise.deviceAttributes.getDirectoryDeviceId(function(asset_id) {
//Open a tab and append the asset id to the end
chrome.tabs.create({ url: "http://<<your website here>>/launch.jsp?host=" + asset_id});
});
//If enterprise deviceAttributes are not available do something else
}else{
//No device Id found
}
});

You would need to change the url on line 12 of the above code and create a page to handle the argument passed to it, or run some other code using the Id that is returned.

The Id takes the following form from the testing I’ve done:

2x9x0x4x-ex9x-4x3x-ax9x-ex1xdx1x3xcx

(I’ve added some “x” to my own machine’s Id!)

Initial testing appears to be working for our requirement, I hope this is of use to others.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s