I am unable to supply password to runas from commandline
I have tried the following
cmd /C echo my_admin_password | runas /user:DOMAIN\\my_admin_logi
Take a look at this link: runas utility
It's a runas
free utility that have the follwing features:
It accepts password as a command line parameter so that it can be used in batch files.
It can bind started process to the interactive user Desktop so it can be used to start interactive processes from various services such as 24x7 Scheduler, 24x7 Event Server and other.
Note: Professional version of RunAs also supports encryption of the entire command line, which administrators can use to give regular users access to certain programs requiring admin-level privileges. Users don't need to know the administrator's password and cannot use it to run anything else… simple, yet very efficient solution for this common problem.
Also you can try pass the password as input for the process using subprocess.Popen.communicate
or even subprocess.Popen.stdin.write
.
Other interesting links:
How to pass a password to a process?
Command-line runas with password
PsExec