Dear monks,

I've searched perlmonks and google and MSDN, but haven't found a solution for my problem. It looks very similar to Problems with Win32::OLE and ADSI

I try to connect to a Win2003 Active Directory running on a specific server from remote and log on as a certain user. The client is WinXP and a member of a subdomain, and the connect works well with adsi-browsers or pure ldap browsers or Net::LDAP, ane even this way of ADSI:

my $conn = Win32::OLE->new("ADODB.Connection"); $conn->{Provider} = "ADsDSOObject"; $conn->Open("ADSI Provider");

works fine, but there I don't know how to specify a certain server/user/password.

But I've got the problem that I can't logon with perl and the following way of ADSI.

The Perl-code stripped down to the essentials looks about the following

#! /usr/bin/perl use warnings; use strict; use Win32; use Win32::OLE; use Win32::OLE::Variant; my $server = "10.6.5.4"; my $base = "DC=myCompany,DC=at"; my $user = "cn=Administrator,cn=Users,$base"; #my $user = "Administrator"; my $pass = 'abcdefg'; my $objNameSpace = Win32::OLE->GetObject("LDAP://$server/$base") or die "Error: can't create LDAP object: $!\n"; # until now, everything has been fine, but now... #my $connectString = "LDAP://$server/$base"; #my $connectString = "LDAP://$base"; #my $connectString = "LDAP://$server/"; my $connectString = "LDAP:///$base"; print "Connectstring: $connectString\n"; my $conn = $objNameSpace->OpenDSObject ($connectString, $user, $pass, 0x01); use Data::Dumper; print Dumper($conn); # conn is undef my $err = Win32::OLE->LastError(); die "Error in bind: $err\n" if $err;

It seems not to matter what I use in $connectString, I always get the following error message:

D:\StratSync>testADSI.pl Connectstring: LDAP://10.6.21.131/DC=mlhelab,DC=de $VAR1 = undef; Error in bind: Win32::OLE(0.1701) error 0x8002000e: "Unzulőssige Param +eteranzahl" in METHOD/PROPERTYGET "" D:\StratSync>

(not correct count of parameters in...)

Well, Activestate OLE-Browser and MSDN tell me:

Function OpenDSObject(lpszDNName As String, lpszUserName As String, lp +szPassword As String, lnReserved As Long) As Object

Well, I've got four parameters, and for lnReserved I used every single parameter from ADS_AUTHENTICATION_ENUM (even 0x200)

Have you got any idea what I'm doing wrong?

Best regards,
perl -e "s>>*F>e=>y)\*martinF)stronat)=>print,print v8.8.8.32.11.32"


In reply to ADSI -> 0x8002000e Error by strat

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.