[python-win32] Re: Is there a Python win32 RunAs equivalent whereyoucan send a password?

Christian Wyglendowski Christian.Wyglendowski at greenville.edu
Thu Mar 18 11:35:38 EST 2004


> -----Original Message-----
> 
> Does this whole impersonation business work with os.system()? 
> What about the threading module? I'm not having any luck with it.
> 
> Per the cookbook site I got this to run:
> 
> 
> try:
>     a.logon()
>     print win32api.GetUserName()
>     os.system("notepad")
>     a.logoff()
> except:
>     print sys.exc_type, sys.exc_value
> 
> 
> the print win32api.GetUserName() prints the impersonated 
> user's name like I expect, but the notepad process is running 
> as _me_, not the impersonated user (@&$#^@$!!!). Am I doing 
> something wrong?
> 
> I briefly toyed with win32process.CreateProcessAsUser, but 
> that put me back at square one with the error about not 
> having a required privilege.
> 

You might want to have a look at this thread on Google Groups:
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&threadm=3e27
3aac_6%40corp-goliath.newsgroups.com&rnum=2&prev=/groups%3Fhl%3Den%26lr%
3D%26ie%3DUTF-8%26oe%3DUTF-8%26q%3Dpython%2Bimpersonate%26sa%3DN%26tab%3
Dwg

It sounds like this whole process (no pun intended) is a real pain.

Christian
http://www.dowski.com



More information about the Python-win32 mailing list