I have the script below. This is actually a test version taken out of my
cgi that checks if the user is a valid user on windows 2000 server. Its
working but I can not find pieces of information about the user that I am
seeking. Please see comments in the code below. Thanks.
use Win32;
use Win32::OLE qw( in );
use Win32::OLE::Const 'Active DS Type Library';
my ($script, $user_name, $cgi, $action, $cookie);
$user_name = 'norrisj';
$action = &ADS_check_name($user_name);
exit(0);
sub ADS_check_name{
my ($user_name) = @_;
my ($AD, $path);
my $cnt = 0;
$path = "WinNT://" . Win32::DomainName();
if ( $AD = Win32::OLE->GetObject( $path ) ){;
my $Schema = Win32::OLE->GetObject( $AD->{Schema} );
if( $Schema->{Container} ) {
$AD->{Filter} = "f=user";
my $Object;
foreach $Object ( in( $AD ) ) {
next if ($Object->{Class} ne 'User');
# I have the clase of user and I can check Name
# agains my user name. Are there any other keys for Object?
# how do I examine them?
++$cnt if ($Object->{Name} eq $user_name);
last if ($cnt);
}
} else {
die "The '$AD->{ADsPath}' is a $AD->{Class} object.\n";
}
}
return ($cnt);
}
_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs