Not really a Perl solution but you could always use the output of nbtstat. -----Original Message----- From: Patrick J. LoPresti [mailto:[EMAIL PROTECTED] Sent: Saturday, March 08, 2003 10:37 AM To: John Deretich Cc: Perl-Win32-Admin-Request (E-mail) Subject: Re: signoff message
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 _______________________________________________ Perl-Win32-Admin mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
