Forum Discussion
Benjamin1998
Oct 17, 2022Copper Contributor
Get-MgUser - how to get only users?
Is there a filter for this command to get only users and no rooms and resources as result?
- Oct 17, 2022
Benjamin1998 Azure AD doesn’t distinguish between an account used by a human and one used by a resource, like a shared mailbox. You’ll have to filter the set returned to get the data you want. This is one reason why I often use Get-
ExoMailbox instead as it’s easier to filter the set.
Oct 17, 2022
Benjamin1998
Oct 17, 2022Copper Contributor
I can't find solution there.
- Oct 17, 2022Well, even the examples show some pointers. You better head off to Tonys article.
- TonyRedmondOct 17, 2022MVP
Benjamin1998 Get-MgUser -All -Filter "userType eq 'member'"
See https://office365itpros.com/2022/03/24/azure-ad-user-account-powershell/ for lots more about Get-MgUser
- Benjamin1998Oct 17, 2022Copper ContributorHello Tony,
I always get users and ressources.
How to get only users?- TonyRedmondOct 17, 2022MVP
Benjamin1998 Azure AD doesn’t distinguish between an account used by a human and one used by a resource, like a shared mailbox. You’ll have to filter the set returned to get the data you want. This is one reason why I often use Get-
ExoMailbox instead as it’s easier to filter the set.