Please note, you need to be more explicit when saying "logged in users".
This script actually will tell you who's INTERACTIVELY logged in, not who
has a network session to the machine.
In any case, the original code worked.
Leave the line
$computer = "$ARGV[0]" ;
then provide the computer name as argument to the script, either
with or without preceding backslashes.
Ex :
Perl scriptname.pl rwaldock
or
Perl scriptname.pl \\rwaldock
This way you don't have to edit the code
to target another machine.
_____________________________________________
Bruno Bellenger
Sr. Network/Systems Administrator
-----Original Message-----
From: [EMAIL PROTECTED] [SMTP:[EMAIL PROTECTED]]
Sent: mercredi 14 mars 2001 12:02
To: [EMAIL PROTECTED]
Subject: Finding Logged in users
Hi,
I have today seen reference to and have installed the lanman module.
I cant find any documentation for it.
I would like to use it to find the logged in users to our
development
server at http://xxx.xxx.xxx
I am using NT and are connected to it via our own intranet.
I have tried the following code but it gives an error 123
# NetWkstaUserEnum($server, \@info)
# Lists information about all users currently logged on \\$computer.
# Specify target machine as argument (with or without preceding \\)
#==============================================
# SPECIFY TARGET COMPUTER AS FIRST ARGUMENT;
#==============================================
use Win32::Lanman ;
#$computer = "$ARGV[0]" ;
$computer = '//rwaldock' ;
print "\n" ;
$computer = substr($computer,2,) if (substr($computer,0,2) eq
"\\\\") ;
print "------------[Listing logged in users on
$computer]------------\n" ;
if(!Win32::Lanman::NetWkstaUserEnum("\\\\$computer", \@info)) {
print "Sorry, something went wrong; error: ";
# get the error code
print Win32::Lanman::GetLastError();
print " : $^E\n" ;
exit 1;
}
foreach $user (@info) { @keys = keys %$user;
foreach $key (@keys)
{
${$user}{$key} =~ s/^a-//i ;
print "$key=[${$user}{$key}]\t";
$mail_alias = ${$user}{username} ;
}
print "\n\n" ;
}
I am very new to this module and have almost no idea what it does or
how it does it and would appreciate any help.
I have full access to the web server via pc-anywhere and so I can do
anything to it.
I am using to try to find out what students are logged in to it and
using Frontpage.
Thanks
Roy
_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-admin
_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-admin