I'm try to pull some information from Active Directory using Win32::OLE. I'm using example code from the Active Directory cookbook but i'm still getting this error:

OLE exception from "Provider": <p>One or more errors occurred during processing of command.</p> Win32::OLE(0.1702) error 0x80040e14 in METHOD/PROPERTYGET "Execute" at sdomain.pl line 11
Here is the code I'm using.
my $strBase = "LDAP://dc=corp,dc=example,dc=edu;"; + # BaseDN should be the search base my $strFilter = "(&(objectclass=user)(objectcategory=Person));"; + # Valid LDAP search filter my $strAttrs = "name,mailNickname,extensionAttribute1;"; + # Comma-seperated list my $strScope = "Subtree"; + # Should be on of Subtree, Onelevel or Base use Win32::OLE; $Win32::OLE::Warn = 3; my $objConn = Win32::OLE->CreateObject("ADODB.Connection"); $objConn->{Provider} = "ADsDSOObject"; $objConn->Open("Active Directory Provider"); my $objRS = $objConn->Execute($strBase . $strFilter . $strAttrs . $str +Scope); $objRS->MoveFirst; while (not $objRS->EOF) { print $objRS->Fields(0)->Value,"\n"; $objRS->MoveNext; }

Any help would be great.


In reply to Help using Win32::OLE by rlb3

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.