Intune CMDB import to SN

linoyv691904179
Tera Contributor

Hi everyone

 

I’m importing Intune managed devices into cmdb_ci_computer via a Data Source (scripted) that calls Microsoft Graph:

Issue
Everything loads fine (paging works, fields are populated), except:

  • physicalMemoryInBytes is always 0

  • wiredIPv4Addresses is undefined

Here’s the relevant (simplified) part of the Data Source script:

(function loadData(import_set_table) {
try {
var r = new sn_ws.RESTMessageV2('Azure Intune', 'device_import');
r.setEndpoint('https://graph.microsoft.com/v1.0/deviceManagement/managedDevices');
var response = r.execute();
var parsed = new JSONParser().parse(response.getBody());
var nextPage = parsed['@odata.nextLink'];

insertToImportTable(parsed.value);

while (nextPage && nextPage.indexOf("$skiptoken") > -1) {
var q = new sn_ws.RESTMessageV2('Azure Intune', 'device_import');
q.setEndpoint(nextPage);
var parsed1 = new JSONParser().parse(q.execute().getBody());
nextPage = parsed1['@odata.nextLink'];
insertToImportTable(parsed1.value);
}
} catch (ex) {}

function insertToImportTable(arr) {
if (!arr || !arr.length) return;
for (var i = 0; i < arr.length; i++) {
import_set_table.insert({
'u_devicename': arr[i].deviceName,
'u_operatingsystem': arr[i].operatingSystem,
'u_serialnumber': arr[i].serialNumber,
'u_physicalmemoryinbytes': arr[i].physicalMemoryInBytes,
'u_wifimacaddress': arr[i].wiFiMacAddress,
// ... many other fields ...
});
}
}
})(import_set_table);

 

Any guidance or best practices would be appreciated.

 

Thanks in advance! 

Linoy



0 REPLIES 0