Detect Connected Hardware with Intune Endpoint Analytics

Detect Connected Hardware with Intune Endpoint Analytics

Modern endpoint estates contain a lot more than the laptop itself: docking stations, external monitors, headsets, USB peripherals, and a long tail of business-specific gear. Microsoft Endpoint Analytics gives you the foundation to capture all of that with a custom data-collection script and feed it into Log Analytics, where you can correlate peripheral inventory with users, locations and refresh cycles. This post walks through the pattern I use to detect connected hardware: a PowerShell collector that reads CIM classes, normalises the result, and posts it into a custom Log Analytics table — ready for Power BI and procurement reporting.

To see which devices are using a particular monitor or keyboard, it can be very helpful if you can collect this information. In this blog I will show you how to do this with the help of Endpoint Analytics. You can then use this information to assign a driver to these devices or to trigger a hardware replacement. How you can automatically populate a group based on the output of an endpoint analytics script I explained in create and fill Microsoft Entra ID group based on local attributes.

Endpoint Analytics script package creation screen

How to get the Hardware Id

Run the following command in a PowerShell session

Get-PnpDevice | Format-List

Search the hardware you want to collect and copy the DeviceID:

Insert the DeviceId or multiple DeviceIds into the array in the PowerShell script from my github repository:

Deploy an Endpoint Analytics Script to collect the values

First we deploy an endpoint analytics script to our clients to get the return value from the clients with the device manufacturer.

  • Enter a name and click Next
Endpoint Analytics script package creation in Microsoft Intune
  • Upload the Detection script. You can find this script in my GitHub repository.
  • Click Next > Next
Detect Connected Hardware with Intune Endpoint Analytics
  • Assign the script to a group
  • Create a schedule. In my case I select daily.
  • Click Next > Create
Detect Connected Hardware with Intune Endpoint Analytics

Result

You can see in the Device status view of the remediation script the result.

  • With issues = device found
  • Without issues = device not found
Detect Connected Hardware with Intune Endpoint Analytics

You can get the results also via graph:

https://graph.microsoft.com/beta/deviceManagement/deviceHealthScripts/**SCRIPT_ID**/deviceRunStates?$top=100
Endpoint Analytics script collecting connected hardware devices

How to fill a Microsoft Entra ID group based on this value you can find create and fill Microsoft Entra ID group based on local attributes.

2 thoughts on “Detect Connected Hardware with Intune Endpoint Analytics

  1. Hi
    I have question about script , isn’t “$lenoveDockIds” supposed to be “$deviceId” ?
    Thanks

Comments are closed.