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

PowerShell
Edit|Remove
$strFilter = "(objectCategory=User)"

$objOU = New-Object System.DirectoryServices.DirectoryEntry("LDAP://OU=Finance,DC=fabrikam,DC=com")

$objSearcher = New-Object System.DirectoryServices.DirectorySearcher
$objSearcher.SearchRoot = $objDomain
$objSearcher.SearchScope = "Subtree"
$objSearcher.PageSize = 1000
$objSearcher.Filter = $strFilter

$colProplist = "name"
foreach ($i in $colPropList){$objSearcher.PropertiesToLoad.Add($i)}

$colResults = $objSearcher.FindAll()

foreach ($objResult in $colResults)
    {$objItem = $objResult.Properties; $objItem.name}