Jump to content

Runas command


Recommended Posts

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

Link to comment
Share on other sites

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.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...