Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Get-AzureAdUser is there a way to pull back all users from source "windows server ad"?

I have a directory that has about 200k users in it. I need to pull back all the users that came from on-prem AD. This of course would exclude the multiple source guest users. I have to use source because not all users have a usertype.

If there was a way to search Department not equal to null that would work as well, but it doesn't appear to be part of the odata filter standard.

Get-AzureADUser -Filter "Department eq ''"  | select DisplayName,`
    UserPrincipalName,Mail,creationType,AccountEnabled,Department
like image 875
Sean Knox Avatar asked Sep 19 '25 11:09

Sean Knox


1 Answers

To get users that come from on-prem AD you could do something like this

 Get-AzureADUser -Filter "dirSyncEnabled eq true"

For selecting only a few, other operators like top can be used as well.. e.g.

 Get-AzureADUser -top 5 -Filter "dirSyncEnabled eq true"

To get all users one shot you can do

Get-AzureADUser -All $true -Filter "dirSyncEnabled eq true"

or

Get-AzureADUser -all $true | where-object -property DirSyncEnabled -eq "True"
like image 59
Rohit Saigal Avatar answered Sep 22 '25 08:09

Rohit Saigal



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!