1

I am writing a program to invoke a script, Java to pass args to a Python script

I would like this script to be invoked with elevated credentials WITHOUT prompting me for password. So far, I found the following solution

echo Plaintextpassword | runas /user:DOMAIN\privilegeduser cmd /c python ps.py sender-ip=10.10.10.10

But it does not work because the console displays RUNAS USAGE.

How to fix this?

Community
  • 1
  • 1
Glowie
  • 2,271
  • 21
  • 60
  • 104

1 Answers1

1

You get the RUNAS USAGE because the command needs to be a single parameter (that is, enclosed in quotes). I couldn't get the password echo part to work but the runas part is:

runas /user:DOMAIN\privilegeduser "cmd /c python ps.py sender-ip=10.10.10.10"
tdelaney
  • 73,364
  • 6
  • 83
  • 116
  • this is quite helpful. I'm trying to see if there is a way the program will automatically read in the password without prompting the user to enter it manually – Glowie Jul 01 '14 at 19:43
  • check out the /savecred option. I haven't used it myself and cant give you much advice except that its used to save the password for later reuse. – tdelaney Jul 01 '14 at 22:55