Powershell LDAP query

mikedisd2mikedisd2 Member Posts: 1,096 ■■■■■□□□□□
I need to run an LDAP query on DC in another AD domain. I'm trying the following:


$cred = Get-Credential
$domain = [ADSI]"LDAP://DC01/ou=domain users,dc=company,dc=org"
$root = new-object system.directoryservices.directorysearcher $domain, $cred
$user = $root.findall()
$user

There's a heap of variations on the web and, for me they all return the same error:

Exception calling "FindAll" with "0" argument(s): "The server is not operational".

It may have to do with permissions; this script works fine on the local AD. Can't find out why the FindAll never works.
Sign In or Register to comment.