Forum Discussion
Teijo Hämäläinen
Apr 29, 2019Copper Contributor
How to list users synced from onprem AD and cloud-only users?
Hello guys! I was tasked to list users synced from onprem AD and cloud only users I have downloaded and imported AzureAD PS module 2.0.2.16 Azure portal shows several users with source 'A...
- Apr 29, 2019
Teijo Hämäläinen I would try following Get-MsolUser -All | ?{-not $_.lastdirsynctime}
VasilMichev
Apr 29, 2019MVP
There's also Get-MsolUser -Synchronized. Using the server-side filtering is faster approach, and also makes sure you don't get a trimmed list because of hitting the limit for number of objects returned (like when you have the Get-AzureADUser cmdlet above, without the -All switch, and filtering client-side).
Martin Rublik
Apr 30, 2019Brass Contributor
thanks, definitely a better solution.
Martin
- Scorpio69May 04, 2019Copper Contributor
Martin RublikThere is another easier option to use it. Cloud only and on prem users have big difference - Its called Immutable ID
So Get-MsolUser | where-Object {$_.ImmutableId -eq $null} -> for On prem users
Get-MsolUser | where-Object {$_.ImmutableId -ne $null} for Azure AD users ( Cloud users)