?
Solved

Windows Command: RUNAS - with a password

Posted on 2009-03-31
6
Medium Priority
?
2,628 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 11

Accepted Solution

by:
bmatumbura earned 600 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 600 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 600 total points
ID: 24029501
You could also try this utility: http://www.softtreetech.com/24x7/archive/53.htm
0
NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

 
LVL 71

Assisted Solution

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

Assisted Solution

by:sirbounty
sirbounty earned 600 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

Enroll in September's Course of the Month

This month’s featured course covers 16 hours of training in installation, management, and deployment of VMware vSphere virtualization environments. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If like me you are one who spends a lot of time working and scripting with cmd.exe, sometimes it is handy to be able to quickly view a calendar for a given month and year. This script will quickly do just that!  Save the code posted below to a .bat …
How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

719 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