[python-win32] Is there a Python win32 RunAs equivalent where youcan send a password?

Bill boober95 at rogers.com
Thu Mar 18 18:19:19 EST 2004


Alan,

I haven't been following this, but I see one problem you will have is you 
need to do a 'pin.close()'.  In general you don't know when a processes will 
send it's output due to buffering, and you might not have any control.  (So 
the 'flush' will send the input, but when will the output be sent?)  You 
might try changing your 'flush' to a 'close' and see what happens.

If I've missed your point, just ignore me, just my 2 cents.

/bill


On March 18, 2004 04:21 pm, R. Alan Monroe wrote:
> > used a COM object called sfImpersonator to some success.  You probably
> > *could* spawn a cmd file and use popen to send the password, but it
> > would have to be a hack.
>
> What's the trick to using the popen approach? (I've temporarily given
> up on the windows api method) Everything I've tried gives me IOError:
> [Errno 22] Invalid argument when I tried to write() to the child's
> stdin, or the main program just exits killing any children.
>
> I've tried this with and without the "cmd" at the front, wrapping it
> in a cmd file, etc.
>
>
> pin, pout  = os.popen2( 'cmd /C runas /user:tco\pyadmin  "dumpsec
> /computer=\\\\ess /rpt=allsharedirs /showexcdirs \ /outfile=ess-shares.tsv
> /saveas=tsv" ')
> print pin, pout
> pin.write('xxxxxx\n')
> pin.flush()
>
>
> Alan
>
>
> _______________________________________________
> 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