Search for All the Users in a Specified OU and Any Sub OUs

Sample scripot that searches Active Directory for all the users in the Finance OU and any child Ous..

1 Star
Add to favorites
Active Directory
E-mail Twitter Digg Facebook
  • BUG
    1 Posts | Last post June 30, 2010
      $objOU was defined, but $objDomain was used: 
      $objOU = New-Object System.DirectoryServices.DirectoryEntry("LDAP://OU=accounting,DC=domain,DC=local")
      $objSearcher = New-Object System.DirectoryServices.DirectorySearcher
      $objSearcher.SearchRoot = $objDomain
      Need replace $objDomain with $objOU to get correct result.