Share via


Find AD users with blank (empty or null) DisplayName

Question

Tuesday, February 21, 2017 3:34 PM

I am using Get-ADUser to find users with a blank displayname value. I can't find a way to do this with -Filter. Instead I am doing

this:

$Users=Get-ADUser-Filter* |where{$_.displayname -ne$null}

Is it possible to do it with the -Filter?

Thanks,

Paul

All replies (3)

Tuesday, February 21, 2017 3:48 PM

Good approach, server side filters are much better. Use the ldapfilter for that, like this.

get-aduser -LDAPFilter "(!displayname=*)"

Update: Richard's example is the same, PowerShell converted to Ldap. 

Cheers,

Ruud
Twitter:    Blog: AzureStack.Blog  LinkedIn:    
Note: Please “Vote As Helpful” if you find my contribution useful or “Mark As Answer” if it does answer your question. That will encourage me - and others - to take time out to help you.


Tuesday, February 21, 2017 5:29 PM

I have tested and both work. Thanks for helping me with a simpler script.


Friday, February 28, 2020 6:14 PM

Thanks for posting your example where clause. It was very useful for me.

Al of the County