Thanks Scott. That was the difference. I know my code was messy. I will need to ensure that my scoping is done correctly.
Thanks everyone, PJ --- Scott Campbell <[EMAIL PROTECTED]> wrote: > Try upgrading your Lanman 1.09.1 to 1.09.2. .1 had > many bugs. It can > be found at www.cpan.org. > > Scott Campbell > Senior Software Developer > Somix Technologies > (207) 324-8805 > http://www.somix.com > > -----Original Message----- > From: > [EMAIL PROTECTED] > [mailto:perl-win32-admin-admin@;listserv.ActiveState.com] > On Behalf Of > Paul Jansen > Sent: Sunday, November 03, 2002 11:39 PM > To: [EMAIL PROTECTED] > Subject: win32-lanman iteration problems > > Hi. > > I'm having a problem witht he win32-lanman module. > I'm using ActivePerl 620, lanman 1.09.1. > > A breakdown of my code is below. I'm trying to get > the members of an array of gloabl groups. It is > failing after the first iteration. I'm suspecting > that this is due to a hash not being undef'ed or > something. I can change the order of the global > groups in the array and still only the first one > succeeds (no matter what the order). Has anyone got > any ideas? The code's a little messy but I've tried > to distill it as much as I can. > > * * * * * > use Win32::Lanman; > > Win32::Lanman::NetGetDCName("", $domain, \$pdc); > print "pdc is $pdc\n"; > $userdomain =~ tr/a-z/A-Z/; > $group_counter = 0; > $user_counter = 0; > @group_array = ("EAU-Messaging Team", "Domain > Admins", > "EAU-ESOEServices", "EAU-ONCALL-ADMIN", > "EAU-EPALAN-ADMIN"); > > print "\nGROUP ACCOUNTS\n\n"; > foreach $group (@group_array) { > print "$group -\n"; > undef $returned_domain; > undef $returned_group_name; > undef @group_members; > undef %group_members; > ($returned_domain, $returned_group_name) = > split(/\\/, $group); > $returned_domain = "EMDAU"; > print "returned_group_name is $returned_group_name > -\n"; > Win32::Lanman::NetGetDCName("", $returned_domain, > \$group_pdc); > print " group_pdc is $group_pdc -\n"; > # if (Win32::Lanman::NetGroupGetUsers($group_pdc, > $returned_group_name, \@group_members)) { > if (Win32::Lanman::NetGroupGetUsers($group_pdc, > $group, \@group_members)) { > foreach $element2 (@group_members) { > # print " $element2\n"; > foreach $element3 (keys %{$element2}) { > print " $element3 - > ${$element2}{$element3}\n"; > } > undef $element2; > undef %{$element2}; > } > } else { > print " unable to get members!\n"; > print " Sorry, something went wrong; error: "; > # get the error code > $error_code = Win32::Lanman::GetLastError(); > print " $error_code\n"; > print " > ".Win32::FormatMessage($error_code)."\n"; > } > } > > > Thanks, > PJ > > http://careers.yahoo.com.au - Yahoo! Careers - 1,000's of jobs waiting online for you! _______________________________________________ Perl-Win32-Admin mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
