The Get-MgUser cmdlet in Microsoft Graph PowerShell enables administrators to retrieve user details from Microsoft 365. The -Search parameter is a powerful feature that allows users to perform text-based searches on specific user properties. This article explores how to use -Search effectively with Get-MgUser, including practical examples to simplify user management.
Below are some commonly used search queries with Get-MgUser:
Get-MgUser -All -Search "displayName:John" -ConsistencyLevel eventual
Get-MgUser -All -Search "mail:johnysins@7xh7fj.onmicrosoft.com" -ConsistencyLevel eventual
Get-MgUser -All -Search "userPrincipalName:timjohnson@7xh7fj.onmicrosoft.com" -ConsistencyLevel eventual
Get-MgUser -All -Search "givenName:John" -ConsistencyLevel eventual
Get-MgUser -All -Search "surname:Singh" -ConsistencyLevel eventual
By leveraging the -Search parameter effectively, administrators can quickly find users in large Microsoft 365 environments. Mastering these techniques will significantly improve user lookup efficiency in Graph PowerShell.
© m365corner.com. All Rights Reserved. Design by HTML Codex