The Get-MgUserCount cmdlet in PowerShell gets the total number of users in the Microsoft Graph.
To use the Get-MgUserCount cmdlet, you must first connect to your Microsoft 365 tenant using the
Connect-MGraph cmdlet. Once you are connected, you can use the Get-MgUserCount cmdlet to get a count of all resources.
Connect-MgGraph -Scopes 'User.Read.All'
The syntax to get the total number of users in the Azure AD is given below.
In this article, we will discuss how to use the Get-MgUserCount cmdlet in PowerShell to get the number of the resource.
How to Get Count of Users in Microsoft Graph
To get the count of users in the Microsoft Graph, use the following command.
Get-MgUserCount -ConsistencyLevel eventual
This command returns the number of resources. The
-ConsistencyLevel parameter indicates the requested consistency level.
I hope the above article on how to use the Get-MgUserCount cmdlet in PowerShell to get the count of all users is helpful to you.
You can find more topics about PowerShell Active Directory commands and PowerShell basics on the ShellGeek home page.