Jump to content

Simple program, was working and now it is not


Recommended Posts

    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

  • Developers

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

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

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...