python1 at spamless.net
Thu Dec 9 19:49:57 CET 2004
Tim Golden wrote:
> | 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?
Sorry for the ambiguity. Yes #1 is correct. I'll try the code you've
> Investigate the win32net module. Something like this:
> import win32net
> import win32netcon
> MACHINE_NAME = 'VOGBP200'
> 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