[python-win32] user currently connected

Tim Golden tim.golden at viacom-outdoor.co.uk
Thu Oct 20 16:35:54 CEST 2005


[le dahut]

> How can I get the name of a user currently connected on a windows
workstation ? I mean a sort of "whoami".

<code>
import getpass
getpass.getuser ()
</code>

Or

<code>
import win32api
win32api.GetUserName ()
</code>

Or

<code>
import os
os.environ['USERNAME']
</code>

TJG

________________________________________________________________________
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:
http://www.star.net.uk
________________________________________________________________________


More information about the Python-win32 mailing list