Solved

Windows Command: RUNAS - with a password

Posted on 2009-03-31
6
2,616 Views
Last Modified: 2012-06-27
Dear Experts,

I am calling an executable file from a batch file.
Can I runas the exe file and also specifying the password for the runas user in the runas command?

Please show by example.

Kind regards.
@ runas /user:localhost\administrator regedit

Open in new window

0
Comment
Question by:Marius0188
  • 3
  • 2
6 Comments
 
LVL 11

Accepted Solution

by:
bmatumbura earned 200 total points
ID: 24029470
The RUNAS command does not have a password parameter for security reasons. You may have to consider using a third party solution instead like this: http://www.robotronic.de/runasspcEn.html
0
 
LVL 67

Assisted Solution

by:sirbounty
sirbounty earned 200 total points
ID: 24029480
Disclaimer: You'll be exposing the admin password this way...any user can get it to use it as an admin.

But you can try this using vbscript (no way that I know of using a simple bat file).


Dim objShell : Set objShell = CreateObject("Wscript.Shell")

strPassword = "PASSWORD"

strCommand = "regedit"
 

objShell.Run "Runas /user:Administrator " & strCommand

wscript.sleep 2500 'wait 2.5 seconds

objShell.AppActivate "Runas.exe"

objShell.Sendkeys strPassword

objShell.SendKeys "~"

Open in new window

0
 
LVL 11

Assisted Solution

by:bmatumbura
bmatumbura earned 200 total points
ID: 24029501
You could also try this utility: http://www.softtreetech.com/24x7/archive/53.htm
0
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
LVL 68

Assisted Solution

by:Qlemo
Qlemo earned 100 total points
ID: 24034121
... or psexec from SysInternals (www.sysinternals.com).
0
 
LVL 67

Assisted Solution

by:sirbounty
sirbounty earned 200 total points
ID: 24034216
Perhaps a better solution could be provided if we knew what you were doing with the registry?
0
 
LVL 67

Expert Comment

by:sirbounty
ID: 24038012
Great - a "B" and no author feedback...
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Using dates in 'DOS' batch files has always been tricky as it has no built in ways of extracting date information.  There are many tricks using string manipulation to pull out parts of the %date% variable or output of the date /t command but these r…
This article was inspired by a question here at Experts Exchange (http://www.experts-exchange.com/Software/Photos_Graphics/Images_and_Photos/Q_28629170.html). The requirements stated in that question are (1) reduce the file size of a large number of…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now