Get AD Users but leave out InetOrgPerson

Quest:
Get-QADUser -LdapFilter “(&(objectCategory=person)(!objectClass=inetOrgPerson))” -Sizelimit ‘0’

well, the search on objectCategory=person is redundant but it took me some time to figure out the negation on LDAP filter

Get-QADUser -LdapFilter “(!(objectClass=inetOrgPerson))”

Microsoft
Get-ADUser -Filter {objectclass -ne “inetorgperson”}

some common LDAP filters:
http://social.technet.microsoft.com/wiki/contents/articles/5392.active-directory-ldap-syntax-filters.aspx

Advertisements

Tagged:

2 thoughts on “Get AD Users but leave out InetOrgPerson

  1. Terry Gardner 8.1.2013 at 14:40 Reply

    The syntax for that filter is actually:

    ‘(&(objectCategory=person)(!(objectClass=inetOrgPerson)))’

  2. soykablog 13.1.2013 at 18:02 Reply

    works for me

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

smsagent

Tips, tricks and time-savers for the Windows and ConfigMgr administrator

To The Point

Anything about Technology and Business

Brian's Power Windows Blog

Microsoft in the Enterprise. Windows, Hyper-V, Exchange, SQL, and more!

PowerScripting Podcast

Shownotes and links for the PowerScripting Podcast, a podcast to help people learn Windows Powershell

Learn Powershell | Achieve More

What is this Powershell of which you speak?

%d bloggers like this: