Administrators often need to identify how many Microsoft Entra objects a user owns. A user may own resources such as Microsoft 365 groups, applications, service principals, or other directory objects. Knowing the ownership count can help administrators audit resource ownership, reassign ownership before deleting accounts, or perform security reviews.
The Get-MgUserOwnedObjectCount cmdlet in Microsoft Graph PowerShell allows administrators to quickly determine the number of directory objects owned by a specific user.
This article explains how to use the Get-MgUserOwnedObjectCount cmdlet with practical examples.
Try the M365Corner Microsoft 365 Reporting Tool â your DIY pack with 20+ out-of-the-box M365 reports for Users, Groups, and Teams.
Get-MgUserOwnedObjectCount
Get-MgUserOwnedObjectCount -UserId <String> -ConsistencyLevel eventual
Important parameters
This command runs the cmdlet without parameters. The console will prompt you to provide the required values interactively.
Get-MgUserOwnedObjectCount
When executed, you will be prompted to enter details:
This approach is useful for quick interactive testing.
You can pass the required parameters directly in the command.
Get-MgUserOwnedObjectCount -Userid samadmin@7xh7fj.onmicrosoft.com -ConsistencyLevel eventual
This command returns the total number of directory objects owned by the specified user.
Typical objects that may be counted include:
Administrators often use this command before removing a user to ensure critical resources still have owners.
You can export the ownership count results for reporting or auditing purposes.
Get-MgUserOwnedObjectCount -Userid samadmin@7xh7fj.onmicrosoft.com -ConsistencyLevel eventual | Export-CSV "d:/Count.csv"
Exporting results can help with:
For count operations in Microsoft Graph, the ConsistencyLevel eventual parameter is required. Without it, the command may fail or return incomplete results.
Example:
Get-MgUserOwnedObjectCount -Userid user@domain.com -ConsistencyLevel eventual
The UserId parameter accepts:
Example:
Get-MgUserOwnedObjectCount -Userid user@domain.com -ConsistencyLevel eventual
or
Get-MgUserOwnedObjectCount -Userid 5f1e8e9a-3e9a-4a8c-9bde-123456789abc -ConsistencyLevel eventual
Before deleting users from Microsoft 365, administrators should check whether the user owns critical resources.
If a user owns groups or applications, ownership should be reassigned to avoid orphaned resources.
After finding the count, administrators may want to identify the specific objects owned by the user.
Example:
Get-MgUserOwnedObject -UserId user@domain.com
This helps determine which resources require ownership transfer.
| Error | Cause | Solution |
|---|---|---|
| Insufficient privileges to complete the operation | The signed-in account does not have permission to read directory data. | Connect to Microsoft Graph with the required permissions. Connect-MgGraph -Scopes "Directory.Read.All" Administrator consent may be required. |
| Invalid request: ConsistencyLevel header required | The ConsistencyLevel eventual parameter was not included. | Add the required parameter when running the command. Get-MgUserOwnedObjectCount -Userid user@domain.com -ConsistencyLevel eventual |
| Resource not found | The specified UserId does not exist in the tenant. | Verify the user exists before running the command. Example: Get-MgUser -UserId user@domain.com Then run the ownership count command again. |
The Get-MgUserOwnedObjectCount cmdlet is a helpful tool for Microsoft 365 administrators who need to quickly determine how many directory objects a user owns. This information is particularly useful during user offboarding, ownership audits, and security reviews.
By combining this cmdlet with other Microsoft Graph PowerShell commands, administrators can identify resources owned by users and ensure that critical objects always have appropriate owners assigned.
Using Graph PowerShell for ownership tracking helps maintain better governance and reduces the risk of orphaned resources in Microsoft Entra ID.
© Created and Maintained by LEARNIT WELL SOLUTIONS. All Rights Reserved.