ajhenson Posted April 21, 2009 Share Posted April 21, 2009 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 More sharing options...
Developers Jos Posted April 21, 2009 Developers Share Posted April 21, 2009 Why not use the internal RunAs() command? SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Graywalker Posted April 21, 2009 Share Posted April 21, 2009 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now