Hello
The code works fine running from my workstation, which is in a domain.
Whenever I move it to the server that is not in any domain I get error. So,
how do I run an Acive Directory query from a server that is not in a domain?
Tried NET USE to authenticate to active directory before running the code,
NETUSE command was successful but the code couldn't contact the domain ("the
specified domain either does not exist or could not be contacted"). Any help
is appreciated
The following binds ok: But what if I need to do an anonymous search without
using
any DN or username or pass?
use Win32::OLE;
my $DSO = Win32::OLE->GetObject('LDAP:');
$DSO->OpenDSObject('LDAP://DOMAINCONTROLLER/cn=username,OU=Users,DC=MYCORP,DC=COM',
'[EMAIL PROTECTED]',
'pass',
0) )
How does the search function change for anonymous search from a detached
host? If I put LDAP://DOMAINCONTROLLER/ in the search string base it
generates error
sub SearchUser {
my $searchterm = shift;
my $strFilter = "((sn=$searchterm));";
my $strAttrs = "distinguishedName;";
my $strScope = "subtree";
my $strBase = "<LDAP://" . $strDomainDN . ">;";
my $objConn = Win32::OLE->CreateObject("ADODB.Connection");
$objConn->{Provider} = "ADsDSOObject";
$objConn->Open;
my $objRS = $objConn->Execute($strBase . $strFilter . $strAttrs .
$strScope);
$objRS->MoveFirst;
while (not $objRS->EOF) {
$strUserDN = $objRS->Fields(0)->Value;
$objRS->MoveNext;
}
Sincerely
_________________________________________________________________
Don't just search. Find. Check out the new MSN Search!
http://search.msn.com/