[python-win32] WMI Win32_LoggedOnUser help

Tim Golden mail at timgolden.me.uk
Fri Sep 2 15:56:10 CEST 2011


On 02/09/2011 13:33, Rod Person wrote:
> Hi,
>
> I've been experimenting with the wmi module and so far everything is
> working great, but I'm having an issue with the Win32_LoggedOnUser
> class. I can seem to access it's properties. When I run the code in
> debug I can see the information I want is being stored in the object
> but all attempts to access it throw an error.

I'm not entirely sure if this is what you're after, but I
*think* it is:

<code>
import wmi

c = wmi.WMI ()
for session in c.Win32_LogonSession ():
   print "Session", session.LogonId
   for associated_user in session.references ("Win32_LoggedOnUser"):
     print associated_user.Antecedent

</code>

TJG


More information about the python-win32 mailing list