Colin Cochrane

Colin Cochrane is a Software Developer based in Victoria, BC specializing in C#, PowerShell, Web Development and DevOps.

Searching Active Directory using PowerShell

I recently discovered a very convenient way to search Active Directory using the [adsisearcher] type accelerator. Here’s a simple example searching for a user based on their first and last names:

$searcher = [adsisearcher]""
$searcher.Filter = "(&(givenName=Pete)(sn=Peterson))"
 
$user = [adsi]($search.FindOne().Path)

Comments (4) -

  • Genevie Bonk

    9/21/2014 5:03:12 PM | Reply

    Good work Smile cheers!

  • stupid

    12/21/2015 6:04:27 AM | Reply

    Aw, this was a really nice post. In idea I would like to put in writing like this additionally – taking time and actual effort to make a very good article… but what can I say… I procrastinate alot and by no means seem to get something done.

  • foolish

    12/23/2015 2:49:07 AM | Reply

    you have a great blog here! would you like to make some invite posts on my blog?

  • COMINT

    12/29/2015 5:23:41 AM | Reply

    After study a few of the blog posts on your website now, and I truly like your way of blogging. I bookmarked it to my bookmark website list and will be checking back soon. Pls check out my web site as well and let me know what you think.

Loading