Get-MgUserRegisteredDevice -UserId $UPN

I’m trying to use Microsoft Graph more and trying PowerShell query such as above. It works but returns a list of object Ids.

How do I get device names or if Enabled and the OS version / Join type / MDM ??

5 Spice ups

Usually Graph will return only what you request. Many of the Powershell commands for Graph have a -Property parameter that lets you specify the data that you want to retrieve.

2 Spice ups

I understand that but it only had ids and some other property. The ids alone aren’t very useful.

Do you know a method of getting the display name of the devices or other information I suggested?

Am I using the wrong command for what I want in that case or do I set result as variable and pipe it to a different command?

1 Spice up

Did you specify the info that you want with the -Property parameter? If you don’t know the specific names of the properties, you can use the wildcard * to return all properties and then find the names of the properties that you need.

1 Spice up

This is all documented.

That cmdlet only returns basic references to the devices. To get richer details like device name , OS version, join type, MDM status, and enabled state, you’ll need to query the Microsoft Graph managedDevices or devices endpoint more directly.

$devices = Get-MgUserRegisteredDevice -UserId $UPN

foreach ($device in $devices) {
    $deviceDetails = Get-MgDevice -DeviceId $device.Id
    $deviceDetails | Select-Object DisplayName, OperatingSystem, OperatingSystemVersion, DeviceId, IsManaged, IsCompliant, DeviceOwnership
}

Get-MgDevice (Microsoft.Graph.Identity.DirectoryManagement) | Microsoft Learn

List registeredDevices - Microsoft Graph v1.0 | Microsoft Learn

3 Spice ups

You can use the select to view specific properties

Get-MgUserRegisteredDevice -UserId $UPN | Select-Object DisplayName, OperatingSystem,TrustType,ManagementType

To view all the properties, use select* . For example,
Get-MgUserRegisteredDevice -UserId $UPN | Select *

You can also try this PowerShell script to export Entra device details with 20+ properties.

2 Spice ups