Sign in to follow this  
Followers 0
JJackel

Simple program, was working and now it is not

5 posts in this topic

    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?

Share this post


Link to post
Share on other sites



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


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

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 :(

Share this post


Link to post
Share on other sites

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

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  
Followers 0