[python-win32] Re: win32process user info

Tom Haddon thaddon at equilar.com
Thu Mar 3 14:50:51 CET 2005


Great! Works a treat! I think I'll go with the run under system account
option.

Tom

-----Original Message-----
From: python-win32-bounces at python.org
[mailto:python-win32-bounces at python.org] On Behalf Of Roger Upole
Sent: Wednesday, March 02, 2005 7:49 PM
To: python-win32 at python.org
Subject: [python-win32] Re: win32process user info


You should be able to use something like this:
      th=win32security.OpenProcessToken(handle,win32security.TOKEN_READ)
 
sid=win32security.GetTokenInformation(th,win32security.TokenUser)[0]
      print win32security.LookupAccountSid('',sid)

However, you're going to need to jack up your privileges sky-high or run
the 
script under
the SYSTEM account.  Otherwise you'll get an Access Denied for most 
processes that
aren't yours.  Last time I needed to do something like this, I used the
Task 
Scheduler
to run it under the System acct.  Running it as a service is another
option.

          Roger


_______________________________________________
Python-win32 mailing list
Python-win32 at python.org
http://mail.python.org/mailman/listinfo/python-win32


More information about the Python-win32 mailing list