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

NAME

Win32::Monitoring::Session - Get information on the logon session

SYNOPSIS

   use Win32::Monitoring::Session qw(GetLogonSessionData GetLogonSessionId);
   my $sessionid = GetLogonSessionId($$);
   my $info = GetLogonSessionData($sessionid);
   print "Logon Time: ".localtime($info->{LogonTime});

DESCRIPTION

The Win32::Monitoring::Session module provides an interface to query Windows for additional session information. Most notably the exact logon time which seems to be rather difficult to get a hold of more or less portable way.

Note that windows seems to treat this kind of information as privileged. As a normal user you can only get information about your own processes and your own session. Admin will be better of in this respect.

$sessionid=GetLogonSessionId($pid)

Returns the LogonSessionId for the process id specified in the argument.

$info_ptr=GetLogonSessionData($sessionid)

Ask the security subsystem for additional information about the given logon session. The information is returned via hash pointer. If there was a problem, there will be a special 'ERROR' and 'ERRORCODE' entries in the hash. The following keys are returned if there is appropriate information available.

 UserName
 LogonDomain
 AuthenticationPackage 
 LogonTime (seconds since 1970 unix time format)

SEE ALSO

Webpage: <http://oss.oetiker.ch/optools/>

COPYRIGHT

Copyright (c) 2008, 2009 by OETIKER+PARTNER AG. All rights reserved.

LICENSE

Win32::Monitoring::Session is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

Win32::Monitoring::Session is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with Win32::Monitoring::Session. If not, see <http://www.gnu.org/licenses/>.

AUTHORS

Tobias Oetiker, Roman Plessl