Collect connected Hardware with Endpoint Analytics

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 this blog post.

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 a 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 manufacture

  • Enter a name and click Next
  • Upload the Detection script. You can find this script in my GitHub repository.
  • Click Next > Next
  • Assign the script to a group
  • Create a schedule. In my case I select daily.
  • Click Next > Create


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

  • With issues = device fount
  • Without issues = device not fount

You can get the results also via graph:**SCRIPT_ID**/deviceRunStates?$top=100

How to fill a AAD group based on this value you can find here.

3 thoughts on “Collect connected Hardware with Endpoint Analytics

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


Comments are closed.