Jump to content
Sign in to follow this  
ajhenson

Runas command

Recommended Posts

ajhenson

I need help with the runas command. I am trying to run a batch file that installs a program, but admin privs are required. can not seem to create Autoit file that will use a service account Here is what I have been using:

Run('C:\WINDOWS\system32\runas.exe /user:XXXX/password"\\server1\apps\Install\softare\V12.10\sofware.bat", "", @SW_HIDE"')

WinWait("C:\WINDOWS\system32\runas.exe","")

If Not WinActive("C:\WINDOWS\system32\runas.exe","") Then WinActivate("C:\WINDOWS\system32\runas.exe","")

WinWaitActive("C:\WINDOWS\system32\runas.exe","")

Send("{SHIFTDOWN}t{SHIFTUP}omcat{SHIFTDOWN}1{SHIFTUP}2653{ENTER}")

please help

Share this post


Link to post
Share on other sites
Graywalker

I need help with the runas command. I am trying to run a batch file that installs a program, but admin privs are required. can not seem to create Autoit file that will use a service account Here is what I have been using:

Run('C:\WINDOWS\system32\runas.exe /user:XXXX/password"\\server1\apps\Install\softare\V12.10\sofware.bat", "", @SW_HIDE"')

WinWait("C:\WINDOWS\system32\runas.exe","")

If Not WinActive("C:\WINDOWS\system32\runas.exe","") Then WinActivate("C:\WINDOWS\system32\runas.exe","")

WinWaitActive("C:\WINDOWS\system32\runas.exe","")

Send("{SHIFTDOWN}t{SHIFTUP}omcat{SHIFTDOWN}1{SHIFTUP}2653{ENTER}")

please help

$username = serviceaccount
$domain = yourdomain
$password = the_above_shown_password ; which I would suggest changing ASAP. :D
RunAs($username, $domain, $password, 0, "\\server1\apps\Install\softare\V12.10\sofware.bat", "", @SW_HIDE)

That may work.

Of course, I'd probably work the batch file into the autoit script and eliminate the middle-man so to speak.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×