The other strategy that may speed up your script is to loop through the user
list once and store the results in a hash (key=user, value=scriptpath)
rather than looping through the user list for each script path.  Then you
can loop through the hash which is already in local memory.

Thanks,
Shaun


-----Original Message-----
From: Kirk W. Batzer [mailto:[EMAIL PROTECTED]] 
Sent: Saturday, October 05, 2002 10:50 AM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: RE: Win32::NetAdmin - GetUsers...Why so slow?


Dave,

I can remember a similar problem where I was getting user attributes for
over 15,000 domain users.  The process took over 8 hours going against the
PDC.  When I changed the call to query a local BDC the time was reduced to
less than 3 hours.

Try querying a local domain controller.  Chances are there will be fewer
network hops and higher network bandwidth between your PC and the BCD.

Network latency can have a huge time impact when querying for domain user
attributes.


Kirk



> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]] On Behalf Of 
> Dave Neese
> Sent: Saturday, October 05, 2002 9:37 AM
> To: [EMAIL PROTECTED]
> Subject: Win32::NetAdmin - GetUsers...Why so slow?
>
>
>
> Hi All,
>
> The following code snippet is being run against an NT Domain with 
> roughly 8000 users. How come it takes over an hour to complete? Is 
> there a more efficient way I am overlooking?
>
> Thanks,
> Dave
>
>
>
> !perl -w
> # Script to get user login scripts.
>
> use strict;
> use Win32::NetAdmin qw(GetUsers);
>
> my $Server = "\\\\pdc";
> my $Group = "Domain Users";
> my %Attribs;
> my $Attribs;
>
> my $dataFile = "D:/bin/logonscripts/phase3_users.csv";
>
>
> &getdata;
>
> #
> --------------------------------------------------------------
> ------------
> ---
>
> sub getdata {
>
> print "Getting users\n";
>
> my @Scripts = (
>               "logon1.cmd",
>               "logon2.cmd",
>               "logon3.cmd",
>               "logon4.cmd",
>               "logon5.cmd"
>               );
>
> open FH, ">$dataFile" or die $!;
>
> for (@Scripts) {
>
>       my $Script = "$_";
>
>       print "Working on $Script\n";
>
>       my $User;
>       my @List;
>
>       if (GetUsers ( $Server, FILTER_NORMAL_ACCOUNT, \@List )) {
>
>               foreach $User ( @List ) {
>                       my %Attribs;
>
>
> Win32::AdminMisc::UserGetMiscAttributes( $Server, $User, \%Attribs);
>                       if ( $Attribs{USER_SCRIPT_PATH}=~($Script)) {
>                               print "$User,$Script\n";
>
>                               print FH "\"$User\"";
>                               print FH ",";
>                               print FH "\"$Script\"";
>                               print FH "\n";
>                               }
>                       }
>               }
>
>       }
>
> print "Finished getting data\n";
>
> close FH;
> }
>
> _______________________________________________
> Perl-Win32-Users mailing list 
> [EMAIL PROTECTED]
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
>


_______________________________________________
Perl-Win32-Users mailing list [EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

-----------------------------------------------------------------------------------------------------------
CONFIDENTIAL & PRIVILEGED


Unless otherwise indicated or obvious from the nature of the following communication, 
the information contained herein is attorney-client privileged and confidential 
information/work product. The communication is intended for the use of the individual 
or entity named above.


 If the reader of this transmission is not the intended recipient, you are hereby 
notified that any dissemination, distribution or copying of this communication is 
strictly prohibited.  If you have received this communication in error or are not sure 
whether it is privileged, please immediately notify us by return e-mail and destroy 
any copies, electronic, paper or otherwise, which you may have of this communication.


_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to