Create User-Device Links from the SCCM/MECM "Most Recent User"

Modified on Thu, 10 Sep at 4:44 PM

Overview

For some SCCM/MECM clients the hardware inventory may fail to report application usage.  This will result in missing user-device links for those devices. It's possible to fill these gaps using SCCM/MECM's "Most Recent User" data as this may be present even when hardware inventory fails. 


This article describes how to automatically use that data to populate missing user-device links using a REST API connector.


Prerequisits

  • The MECM/SCCM connector must be installed and configured
  • Make a note of the following:
    • The ProjectId from Administration -> Project Settings
    • The Most Recent User FieldId (open any device record -> Connectors tab -> MECM -> hover over the Most Recent User text to see the FieldId, 336 in the example below)
    • The Last Updated FieldId from the same tab
    • The domain name



Setup

Step 1 – Create the connector

  1.  Navigate to Administration → Extensions → Connectors
  2.  Click Add New Connector
  3.  Name it (e.g. MECM Recent User)
  4.  Disable Import #1 (toggle to off)
  5.  Enable Import Links (toggle to on)
  6. Configure as below (explanation of settings below image)



Step 2 – Configure the Import Links section 

SettingValueDescription
Link ActionCreateCreates new links. Do not use 'Reject' or 'Delete.
Link Tag(Blank)Leave blank as the name of the connector will be used for Link Tags
Rest Api Endpoint Urlhttps://<mstudio-server>/<ProjectId>/p/
report/datamining/0/
prefilename/json
The URL of the datamining report that returns your device + Most Recent User data. Replace `<mstudio-server>` with your server's URL and `<ProjectId>` with your project id.
Request TypeGetStandard HTTP GET.
Adv. OptionsToggle on


Step 3 – Configure the Headers

HeaderValuePurpose
auth-token[importer-auth-token]Authenticates the connectors request to the API.
datamining-tier1-moduledevicesTells the report to return Device data as the top tier.
datamining-tier1-fieldsdeviceId, hostnameReturns the Device ID and Hostname columns — these identify each device.
datamining-tier1-customfields<MostRecentUserFieldId>, <LastUpdatedFieldId>Returns the MECM connectors **Most Recent User** and **Last Updated** fields. Use the FieldIds you noted in Prerequisites (e.g. 3430, 3420).
datasource-filterexpressionCustomField_<MostRecentUserFieldId> <> ""Only return rows where the Most Recent User field is populated — skips devices with no data.


Note: The datasource-filterexpression uses the internal custom-field name format. If your Most Recent User FieldId is 3430, the filter expression is CustomField_3430 <> "".


 

Step 4 – Configure the Link Mapping table

This is the critical part. The Link Mapping table tells ManagementStudio how to map the fields in the JSON response to the fields needed to create a link between a Device and a User. Each row in the table maps one source field from the API response to a ManagementStudio field. The columns are:

ColumnMeaning
Src. FieldThe field name as it appears in the JSON response (e.g. Devices_DeviceId, CustomField_343)
AppsMaps to an Application field (leave blank for this use case)
UsersMaps to a User Migration field (e.g. SamAccount [F] to match by SamAccount name)
DevicesMaps to a Device field (e.g. DeviceId [A] to identify the device by its internal Id)
MailMaps to a Mailbox field (leave blank)
BespokeMaps to a Bespoke field (leave blank)
SpecialSpecial handling options (e.g. Static:, Clone:, LastUsedDate)
OptionsAdditional per-row options



Src. FieldUsersDevicesSpecialOptionsDescription
Devices_DeviceId(blank)DeviceId [A](blank)*(blank)*Identifies the **Device** side of the link. [A] means "match by internal Application/Device Id".
Domain *(or your
domain field name)*
Domain [F](blank)(blank)Static:MYDOMAINSupplies the **domain** needed to resolve the user. Static: means the value is fixed for every row — replace MYDOMAIN with your actual domain. [F] means "match by field value".
CustomField_<Most
RecentUserFieldId>
SamAccount [F](blank)(blank)(blank)Maps the **Most Recent User** value (which is a SamAccountName) to the Users side of the link. [F] means "match the user by their SamAccount field".
CustomField_<Last
UpdatedFieldId>
(blank)(blank)(blank)(blank)Required for the clone on the next row.
LastUsedDate(blank)(blank)LastUsedDateClone:CustomField_
<LastUpdatedFieldId>
Sets the **Last Used Date** on the created link so that link age / recency tracking works correctly.


Important: Replace <MostRecentUserFieldId> and <LastUpdatedFieldId> with the actual FieldId numbers you noted in Prerequisites. For example, if Most Recent User is FieldId 3430 and Last Updated is FieldId 3420, the rows become CustomField_3430 and CustomField_3420.


Step 5 – Test and Save

  1.  Click Test Retrieval - confirm the JSON response returns rows with DeviceId, hostname, and your two custom fields populated. A CSV file will be created. Review this and ensure the data is correct before proceeding.
  2.  Click Test Import - this will test the import file without creating links. The log shows the link count to be created.
  3.  Click Save Changes at the top of the connector screen.
  4. Click Rest Api Import to run the connector. The links will be created.

Step 6 – Schedule

Set the connector to run on your desired schedule (e.g. daily at 8pm). The Link Action = Create setting means it will only add links that don't already exist — it will not duplicate or overwrite existing user-device links created by other connectors (e.g. the MECM connector's hardware inventory).

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article