the code below work for me with :
perl version 5.6.1 Build 633
lanman 1.0.9.2
Yves.
==========
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 = ("mydomain\\Domain Admins","mydomain\\anothergroup",
"EAU-ONCALL-ADMIN","EAU-EPALAN-ADMIN","EAU-Messaging Team");
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,$returned_group_name,
\@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";
}
}
-----Original Message-----
From: Paul Jansen [mailto:vlaero@;yahoo.com.au]
Sent: Monday, November 04, 2002 5:39 AM
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
_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs