Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>The best source of Active Directory <a href="http://techtasks.com/code/viewbook/2?lang=Perl" rel="noreferrer">example code in Perl is available here</a>. It's from Robbie Allen, the co-author of O'Reilly's excellent <a href="http://oreilly.com/catalog/9780596521110" rel="noreferrer">Active Directory Cookbook</a>.</p> <p><a href="http://techtasks.com/code/viewbookcode/1582" rel="noreferrer">Here is an example</a> from their cookbook code:</p> <pre><code># This Perl code finds all disabled user accounts in a domain. # --------------------------------------------------------------- # Adapted from VBScript code contained in the book: # "Active Directory Cookbook" by Robbie Allen # ISBN: 0-596-00466-4 # --------------------------------------------------------------- # ------ SCRIPT CONFIGURATION ------ my $strDomainDN = "&lt;DomainDN&gt;"; # e.g. dc=rallencorp,dc=com # ------ END CONFIGURATION --------- use Win32::OLE; $Win32::OLE::Warn = 3; my $strBase = "&lt;LDAP://" . $strDomainDN . "&gt;;"; my $strFilter = "(&amp;(objectclass=user)(objectcategory=person)" . "(useraccountcontrol:1.2.840.113556.1.4.803:=2));"; my $strAttrs = "name;"; my $strScope = "subtree"; my $objConn = Win32::OLE-&gt;CreateObject("ADODB.Connection"); $objConn-&gt;{Provider} = "ADsDSOObject"; $objConn-&gt;Open; my $objRS = $objConn-&gt;Execute($strBase . $strFilter . $strAttrs . $strScope); $objRS-&gt;MoveFirst; while (not $objRS-&gt;EOF) { print $objRS-&gt;Fields(0)-&gt;Value,"\n"; $objRS-&gt;MoveNext; } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload