Roman Plessl > Win32-Monitoring-Session-0.04 > Win32::Monitoring::Session



Annotate this POD

View/Report Bugs
Module Version: 0.04   Source  


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


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


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.


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


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.

 LogonTime (seconds since 1970 unix time format)


Webpage: <>


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


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 <>.


Tobias Oetiker, Roman Plessl

syntax highlighting: