thanks for the reply! This flexed my brain a bit, and led me to other avenues, but still didn't work. I still get 1000 lines. You know that feeling when you work on one line for days? That's how I feel. Does pounding one's head against something solid prodce better code? If so, I should be a master by now.
Update
I fiddled with the lines until I got it to work. I'm still not sure if it's the ordering of the commands, the double quotes around Page Size, or some combination thereof. the Full Orphan Script will be posted to the Code catacombs. Thanks to cacharbe for all of his suggestions
sub get_corp_accts{
# get ADO object, set the provider, open the connection
my $ADO = Win32::OLE->new("ADODB.Connection");
$ADO->{Provider} = "ADsDSOObject";
$ADO->Open("ADSI Provider");
# Create the ADO Command
my $ADSPath = "LDAP://OU=group,DC=subdomain,DC=domain,DC=com";
my $ADOCmd=Win32::OLE->new("ADODB.Command");
$ADOCmd->{ActiveConnection}=$ADO;
$ADOCmd->{CommandText}="<$ADSPath>;(objectClass=User);samAccountNa
+me,HomeDirectory;SubTree";#new
$ADOCmd->Properties->{"Page Size"}=10000;
#Execute the Command
my $users=$ADOCmd->Execute;
#Extract the Info (AccountName, HomeDirectory) from the returned o
+bject
until ($users->EOF){
my $homeDir=lc($users->Fields(1)->{Value});
my $account=lc($users->Fields(0)->{Value});
print OUT "$account\t$homeDir\n";
$users->MoveNext;
}
$users->Close;
$ADO->Close;
print "Wrote Accounts\n";
}
-OzzyOsbourne
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|