[python-win32] Query on - win32 impersonate user
Tim Golden
mail at timgolden.me.uk
Mon Jun 8 12:36:44 CEST 2009
Vikas NV wrote:
> Hi,
>
> I have been trying to use the Impersonate user code that you have in
> the PyWin32.chm document.
[... snip ...]
> obj = Impersonate('another_user', '01928348')
> obj.logon()
> print win32api.GetUserName()
> os.system('bash sleep.sh')
> obj.logoff()
Unfortunately when you do os.system, Windows uses the
original user, not the impersonating user. By good
fortune, this issue came up just last week and someone
posted a ctypes implementation of CreateProcessWithLogonW:
http://mail.python.org/pipermail/python-win32/2009-June/009192.html
Hopefully you can take it from there...
TJG
More information about the python-win32
mailing list