JJackel Posted July 24, 2014 Share Posted July 24, 2014 Local $sUserName = "Administrator" Local $sDomain = "MyDomain" Local $sPassword = "password" ; Run CMD with the window hidden. Ran using the previous credentials Local $iPID = RunAs($sUserName, $sDomain, $sPassword, 0, "cmd.exe", "", @SW_HIDE) ;Send keys to open IE then close cmd after Local $hWnd = WinGetHandle("[CLASS:ConsoleWindowClass]", "") ControlSend($hWnd, "", "", '"C:\Program Files\Internet Explorer\iexplore.exe"' & @CRLF) ; Wait for 2 seconds. Sleep(2000) ; Close the cmd process using the PID returned by RunAs. ProcessClose($iPID) This is the code(with changed credentials for security) that I use to try and get an IE window open as admin so my users can use and install activex controls without needing admin privelages. Can someone tell me a better way to keep this working or what might be wrong with my code? Link to comment Share on other sites More sharing options...
Developers Jos Posted July 24, 2014 Developers Share Posted July 24, 2014 You are trying to use Control statements on a program running under different credential and elevation. Can't you simply do this command running that with the right credentials?: Regsvr32 /s file_name.ocx Jos 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...
JJackel Posted July 24, 2014 Author Share Posted July 24, 2014 That wouldn't really help unless I new the exact activex control that was being installed. I do not know the specific activex control always needed so I need their IE to open like this. I had this program working at one point but it just stopped working so I do not really understand that part. I didn't think opening an elevated IE as a different user would be so tough Link to comment Share on other sites More sharing options...
Developers Jos Posted July 24, 2014 Developers Share Posted July 24, 2014 So why not simply run "C:\Program Files\Internet Explorer\iexplore.exe" with the runas? Jos 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...
JJackel Posted July 25, 2014 Author Share Posted July 25, 2014 For whatever reason IE does not ever load when I use that. That was the first thing I tried. I will just have to find another solution 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