Get-EntraObjectByObjectId

Retrieves the objects specified by the ObjectIds parameter.

Syntax

Get-EntraObjectByObjectId
   -ObjectIds <System.Collections.Generic.List`1[String]>
   [-Types <System.Collections.Generic.List`1[String]>]
   [-Property <String[]>]
   [<CommonParameters>]

Description

The Get-EntraObjectByObjectId cmdlet retrieves the objects specified by the ObjectIds parameter.

Examples

Example 1: Get an object One or more object IDs

Connect-Entra -Scopes 'Directory.Read.All'
Get-EntraObjectByObjectId  -ObjectIds 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' , 'bbbbbbbb-1111-2222-3333-cccccccccccc'

Id                                   DeletedDateTime
--                                   ---------------
aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb
bbbbbbbb-1111-2222-3333-cccccccccccc

This example demonstrates how to retrieve objects for a specified object Ids.

  • ObjectIds parameter specifies the One or more object IDs.

Example 2: Get an object by types

Connect-Entra -Scopes 'Directory.Read.All'
Get-EntraObjectByObjectId -ObjectIds 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' -Types User

Id                                   DeletedDateTime
--                                   ---------------
aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb

This example demonstrates how to retrieve objects for a specified object type.

  • -ObjectIds parameter specifies the One or more object IDs.
  • -Types parameter specifies the type of object ID.

Parameters

-ObjectIds

One or more object IDs's, separated by commas, for which the objects are retrieved. The IDs are GUIDs, represented as strings. You can specify up to 1,000 IDs.

Type:System.Collections.Generic.List`1[System.String]
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-Property

Specifies properties to be returned.

Type:System.String[]
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Types

Specifies the type of objects that the cmdlet returns. If not specified, the default is directoryObject, which includes all resource types defined in the directory. You can specify any object derived from directoryObject in the collection, such as user, group, and device objects.

Type:System.Collections.Generic.List`1[System.String]
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Inputs

None

Outputs

System.Object