in reply to Problems with Win32::OLE and ADSI
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"; }
|
|---|