The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Win32::Net::Session - Perl extension for getting informations about connected clients to a server or workstation.

SYNOPSIS

  use Win32::Net::Session;
  my $SESS = Win32::Net::Session->new($server, $level, [$clientname, $username]);
  my $ret = $SESS->GetSessionInfo();
  my $numsessions = $SESS->NumberofSessions();
  if($numsessions == 0) {print "No Clients connected\n"; exit; }
  print "Number of Sessions: " . $numsessions . "\n";
  my %hash = %$ret;
  my $key;
  my $count=0;
  
  while($count < $numsessions)
  {
        my %h = %{$hash{$count}};
        print "The key: $count\n";
        foreach $key (keys %h)
        {
                print "$key=" . $h{$key} . "\n";
        }
        print "\n";
        $count++;
  }

DESCRIPTION

   With Win32::Net::Session you can list informations about conected clients on a Windows server.
   Depending on the level you pass to the function you will get more or less informations.
   Valid levels are: 0,1,2,3 and 4.
   
   The module uses the Win32 API function NetSessionEnum() to retrive the informations.
   
   Lets talk a little bit more about the \"level\":
   At first a restriction: The levels 1,2 and 4 can only be used with an administrator account.
   
   Level 0: Return the name of the computer that established the session.
   (structure: SESSION_INFO_0)
   Level 1: Return the name of the computer, name of the user, and open files, pipes, and devices on the computer.
   (structure: SESSION_INFO_1)
   Level 2: In addition to the information indicated for level 1, return the type of client and how the user established the session.
   (structure: SESSION_INFO_2)
   Level 3: Return the name of the computer, name of the user, and active and idle times for the session.
   (structure: SESSION_INFO_10)
   Level 4: Return the name of the computer; name of the user; open files, pipes, and devices on the computer; and the name of the transport the client is using.
   (structure: SESSION_INFO_502)

FUNCTIONS

new(server, level, [clientname, username])
   The initialation of the module.
   The parameters server and level are mandatory. Clientname and username can be used if you want to get
   informations about a specific client and user.
GetSessionInfo()
  Returns a reference to a hash of hash references.
  Please see the example above how to deal with. 
NumberofSessions()
  Returns the number of session established on a server or 0 if there are no conections.

AUTHOR

Reinhard Pagitsch<lt>rpirpag@gmx.at>

SEE ALSO

perl.