locked
Is it possible to execute an LDAP Query in PowerShell? RRS feed

  • Question

  •  I have a custom query that I run in ADUC for user count.  I'd like to run it in PS and email the results.

    I only need help on integrating the LDAP query in PowerShell.

    Thanks for the help,

    Brad

    • Moved by Bill_Stewart Monday, July 13, 2015 3:37 PM Poor quality question/shows no research effort
    Tuesday, June 9, 2015 8:11 PM

Answers

All replies

  • Yes. Use a search engine.

    http://www.google.com/search?&q=ldap+query+in+powershell

    There's no need to be helpless.


    -- Bill Stewart [Bill_Stewart]

    • Marked as answer by Bill_Stewart Monday, July 13, 2015 3:36 PM
    Tuesday, June 9, 2015 8:14 PM
  • Get-AdUser -LDAPFilter "name=jones"

    ([adsisearcher]'(&(objectcategory=user)(objectclass=person))').FindAll()


    \_(ツ)_/

    Tuesday, June 9, 2015 8:36 PM
  • As noted, use the -LDAPFilter parameter of Get-ADUser, or any other AD cmdlet (like Get-ADObject). If you use Get-ADUser, you do not need any of the clauses that restrict the result to user objects, as the cmdlet only retrieves info on users.

    Richard Mueller - MVP Directory Services

    Tuesday, June 9, 2015 10:57 PM