Skip to content

Instantly share code, notes, and snippets.

@vladimir-kotikov
Created August 11, 2014 19:13
Show Gist options
  • Save vladimir-kotikov/e19c8642548f9f1cb4c5 to your computer and use it in GitHub Desktop.
Save vladimir-kotikov/e19c8642548f9f1cb4c5 to your computer and use it in GitHub Desktop.
How to get device manufacturer and model in windows store apps
var propertiesToRetrieve = ["System.Devices.ModelName", "System.Devices.Manufacturer"];
var pnp = Windows.Devices.Enumeration.Pnp;
var deviceContainer = pnp.PnpObjectType.deviceContainer;
var ROOT_DEVICE_ID = '{00000000-0000-0000-FFFF-FFFFFFFFFFFF}';
pnp.PnpObject.findAllAsync(deviceContainer, propertiesToRetrieve)
.then(function (devinfoCollection) {
for (var i = 0; i < devinfoCollection.length; i++) {
if (devinfoCollection[i].id == ROOT_DEVICE_ID) {
console.log(JSON.stringify(devinfoCollection[i].properties));
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment