I had some really cool ideas on things to try then I found a machine on which I tested your code. It works for me ;-P. All I did was copy and paste then update the values for $username and $password, the path for perl.exe and the LDAP:// path. I am using activestate perl 5.6.1 build 633 active package (not msi) on Windows 2000 server with SP2

Changed: I did this with NTLM auth turned on in IIS. This confirms the earlier post the I couldn't test. Switching auth modes may help get rid the problem

I guess that you don't want to change the auth mode so I got rid of the NT Integrated Auth for more testing. Indeed I straight away got an error message with HRESULT = 0x8007202a. Looking here at MSDN I get the following:

0x8007202aL LDAP_AUTH_UNKNOWN ERROR_DS_AUTH_UNKNOWN

Based on this error and the URL for the man page equivalent for the function in question (OpenDSObject), I changed the username to the UPN of the administrator and the script worked. I then substituted the old Winnt form (DOMAIN\administrator) and it also worked Then I changed it to administrator and it didn't work again.

Of course, the error HRESULT value I get is different to the decimal value I got off you from chatterbox. But is it the same as the hex value I got at the same time? The hex value in the article is missing a digit I think, because they all seem to be 32bit in MSDN.

Also you might find that if you change the bit of code towards the end the error messages are a bit more helpful

my $err = Win32::OLE->LastError(); if $err == 0) { print STDOUT "Success!\n"; $objObjSec->close; } else { print STDOUT $err; print STDOUT "Failure!\n"; }

In reply to Re: Problems with Win32::OLE and ADSI by blm
in thread Problems with Win32::OLE and ADSI by rob_au

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.