Karl... just remember that findall() doesnt return DirectoryEntry and it
acts different. To get a DirectoryEntry you need to call the
GetDirectoryEntry() method on the returned object.
p.s. dont use objectclass
"Karl Mitschke" <kmitschke@xxxxxx> wrote in message
news:7063857f344588ca693ce0bc2465@xxxxxx
| Quote: |  | |
|
> Hello Swamy,
> | Quote: |  | | |
>> Hi,
>>
>> without specifying the complete DN of an object and using
>> [ADSI]"LDAP:// "
>> provider can i serach an object? assuming my AD has many OU and users
>> are
>> spread across many OU?
| | | | | >
> $username = "swamy"
> $searcher = new-object DirectoryServices.DirectorySearcher([ADSI]"")
> $searcher.filter = "(&(objectClass=user)(sAMAccountName= $UserName))"
> $searcher.findall()
>
> | |
| | |