Tim Golden tim.golden at
Thu Dec 9 19:29:42 CET 2004

| Do you know of a way to list the users on a Win2K machine? I 
| can't seem to find a module for this.

Interpretation 1: who is in the user database of a given machine?

Investigate the win32net module. Something like this:

import win32net
import win32netcon


resume = 0
while 1:
  (_users, total, resume) = \
    win32net.NetUserEnum (
  for _user in _users:
    print _user['name']
  if not resume:

Using active directory might also be a possibility.
As with many such questions, the first question is:
how do you do this in Windows generally? And then:
how do you translate that to Python?

Interpretation 2: who is currently logged on to the machine?

This is more difficult. On XP / 2003, there are WMI classes
to tell you this (Win32_LoggedOnUser) but not on 2000.
Likewise, there are LsaEnumerateLogonSessions in XP+,
but not on 2000. 

Anyone else got any ideas?


This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:

More information about the Python-list mailing list