Edit

Share via


Get-EntraDeviceRegisteredUser

Retrieve a list of users that are registered users of the device.

Syntax

Default (Default)

Get-EntraDeviceRegisteredUser

    -DeviceId <String>
    [-All <Boolean>]
    [-Property <String[]>]
    [<CommonParameters>]

Description

The Get-EntraDeviceRegisteredUser cmdlet gets a registered user for a Microsoft Entra ID device. Specify DeviceId parameter to get a registered user for a Microsoft Entra ID device.

In delegated scenarios with work or school accounts, the signed-in user must have a supported Microsoft Entra role or a custom role with the necessary permissions. The following least privileged roles are supported:

  • Directory Readers
  • Global Reader
  • Intune Administrator
  • Windows 365 Administrator

Examples

Example 1: Retrieve the registered user of a device

Connect-Entra -Scopes 'Device.Read.All'
$device = Get-EntraDevice -SearchString '<device-display-name>'
Get-EntraDeviceRegisteredUser -DeviceId $device.Id |
Select-Object Id, displayName, UserPrincipalName, createdDateTime, userType, accountEnabled |
Format-Table -AutoSize
id                                   DisplayName      UserPrincipalName         CreatedDateTime       UserType AccountEnabled
--                                   -----------      -----------------         ---------------       -------- --------------
aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb Maria Sullivan  maria@contoso.com         10/7/2024 12:34:14 AM Member   True
cccccccc-2222-3333-4444-dddddddddddd Parker McLean   parker@contoso.com        10/7/2024 12:34:14 AM Member   True

This example demonstrates how to retrieve registered user for a specific Microsoft Entra ID device.

Example 2: Get all registered users of a device

Connect-Entra -Scopes 'Device.Read.All'
$device = Get-EntraDevice -SearchString '<device-display-name>'
Get-EntraDeviceRegisteredUser -DeviceId $device.Id -All |
Select-Object Id, displayName, UserPrincipalName, createdDateTime, userType, accountEnabled |
Format-Table -AutoSize
id                                   DisplayName      UserPrincipalName         CreatedDateTime       UserType AccountEnabled
--                                   -----------      -----------------         ---------------       -------- --------------
aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb Maria Sullivan  maria@contoso.com         10/7/2024 12:34:14 AM Member   True
cccccccc-2222-3333-4444-dddddddddddd Parker McLean   parker@contoso.com        10/7/2024 12:34:14 AM Member   True

This example demonstrates how to retrieve all registered users for a specified device.

  • -DeviceId parameter specifies an object ID of a device, which you want to retrieve.

Example 3: Get top two registered users of a device

Connect-Entra -Scopes 'Device.Read.All'
$device = Get-EntraDevice -SearchString '<device-display-name>'
Get-EntraDeviceRegisteredUser -DeviceId $device.Id -Top 2 |
Select-Object Id, displayName, UserPrincipalName, createdDateTime, userType, accountEnabled |
Format-Table -AutoSize
id                                   DisplayName      UserPrincipalName         CreatedDateTime       UserType AccountEnabled
--                                   -----------      -----------------         ---------------       -------- --------------
aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb Maria Sullivan  maria@contoso.com         10/7/2024 12:34:14 AM Member   True
cccccccc-2222-3333-4444-dddddddddddd Parker McLean   parker@contoso.com        10/7/2024 12:34:14 AM Member   True

This example demonstrates how to retrieve top two registered users for the specified device. You can use -Limit as an alias for -Top.

  • -DeviceId parameter specifies an object ID of a device, which you want to retrieve.

Parameters

-All

List all pages.

Parameter properties

Type:System.Management.Automation.SwitchParameter
Default value:False
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-DeviceId

Specifies an object ID of a device.

Parameter properties

Type:System.String
Default value:None
Supports wildcards:False
DontShow:False
Aliases:ObjectId

Parameter sets

(All)
Position:Named
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:True
Value from remaining arguments:False

-Property

Specifies properties to be returned.

Parameter properties

Type:

System.String[]

Default value:None
Supports wildcards:False
DontShow:False
Aliases:Select

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Top

Specifies the maximum number of records to return.

Parameter properties

Type:System.Int32
Default value:None
Supports wildcards:False
DontShow:False
Aliases:Limit

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:True
Value from pipeline by property name:True
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.