kelso Posted May 12, 2016 Share Posted May 12, 2016 Hi, Trying to build a script to run SSMS as "run as", everything works perfect from the script editor, but when I compile it, it seems to stop after the first step and does not continue Quote Quote #RequireAdmin #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Outfile=tryyyyyyyy.Exe #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** Global $ip='192.168.1.12' Global $username = 'acdc\aga' Global $pwd = 'Aa123456' Run(@ScriptDir &'\System32\runas.exe /netonly /user:'& $username &' ssms') WinWait("C:\Windows\System32\runas.exe") sleep(1000) ControlSend("C:\Windows\System32\runas.exe","","",$pwd,"") Sleep(1000) ControlSend("C:\Windows\System32\runas.exe","","","{ENTER}","") WinActivate("Microsoft SQL Server Management Studio (Administrator)") WinWait("Connect to Server") Sleep(1000) ControlSend("Connect to Server", "", "[CLASS:Edit; INSTANCE:1]", $ip & "{ENTER}") any idea what could be the problem that it stops after the Run if I run it from command line? Thanks Link to comment Share on other sites More sharing options...
rudi Posted May 13, 2016 Share Posted May 13, 2016 (edited) Hi. 1.) Your Run statement referes to "@scriptdir\system32\runas.exe" (and not "@SystemDir\runas.exe") I doubt, that this is really, what you really want? 2.) It might make a difference, weather you compile to 32 of 64bit 3.) Take a look at the different "System folders": c:\windows\system32 vs. c:\windows\SysWOW64 Try EnvGet("sysnative") See this explanation: http://www.thewindowsclub.com/sysnative-folder-in-windows-64-bit Regards, Rudi. Edited May 13, 2016 by rudi Earth is flat, pigs can fly, and Nuclear Power is SAFE! 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