How to get user's device info in MS Graph?

Jizeth Esperanzate 56 Reputation points
2023-04-03T06:52:08.05+00:00

I am trying to determine what operating system a user is using upon login, whether Mac or Windows. Is there a query on getting it from MS Graph API?

Microsoft Security | Intune | Microsoft Intune MacOs
Windows for business | Windows Client for IT Pros | User experience | Other
Microsoft Security | Microsoft Graph
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Unknown_Beast 150 Reputation points
    2023-04-03T07:20:09.9033333+00:00

    Yes, you can use the Microsoft Graph API to get the operating system of a user's device.

    To get the operating system of a user's device, you can use the "managedDevices" endpoint in Microsoft Graph API. Here are the steps you can follow:

    1. Authenticate: First, you need to authenticate with the Microsoft Graph API using a registered application and an authorized account. You can refer to the Microsoft Graph API documentation for more information on authentication.
    2. Get user's managed devices: Once authenticated, you can call the "managedDevices" endpoint to get a list of devices that are managed by your organization for a specific user. You can use the following endpoint:

    GET https://graph.microsoft.com/v1.0/users/{user-id}/managedDevices

    Note: Replace {user-id} with the ID or userPrincipalName of the user you want to get managed devices for.

    1. Get operating system details: Once you have a list of managed devices, you can retrieve the operating system details for each device by calling the "registeredDevice" endpoint. You can use the following endpoint:

    GET https://graph.microsoft.com/v1.0/devices/{device-id}

    Note: Replace {device-id} with the ID of the device you want to get operating system details for.

    1. Parse operating system details: The "operatingSystem" property of the "registeredDevice" object contains the operating system details of the device. You can use this property to determine the operating system of the device. For example, the "operatingSystem" property might contain the value "Windows 10 Pro" or "MacOS Mojave".

    Note: If the user is not using a managed device, you may not be able to retrieve the operating system details.

    These are the general steps to get the operating system of a user's device using Microsoft Graph API. You can refer to the Microsoft Graph API documentation for more information on managing devices and retrieving operating system details.

    1 person found this answer helpful.

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.