John Deretich <[EMAIL PROTECTED]> writes:

> I was wondering if there's a win32 module that can tell if a user is
> logged on to there machine?

Hm, this appears harder than one might expect.

You can use WMI.  Enumerate all instances of the Win32_LoggedOnUser
class to obtain mappings between accounts and logon sessions, then
check the LogonType field of each session to find the one (if any)
which is interactive.

Documentation for the classes are here:

  http://msdn.microsoft.com/library/en-us/wmisdk/wmi/win32_loggedonuser.asp

  http://msdn.microsoft.com/library/en-us/wmisdk/wmi/win32_logonsession.asp

The catch is that these were introduced with Windows XP, so this will
not work on earlier versions of Windows.  If that is OK for you, and
if nobody else has any better ideas, let me know and I will flesh out
this approach into actual code.

 - Pat
_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to