Jump to content

Installing .EXE With Admin Rights


Recommended Posts

We are trying to send out a package to field users who need to have a replacement application installed. When we run the compiled script as an admin it processes and installs fine. When we run it as a standard user it throws a message that we need admin rights to install the app for all users. Then the processing dies and nothing is installed.

We have the following au3 script which we compiled into a .exe file:

{CODE}

; Declare variables

Local $sUserName = "Encrypted UserAccount"

Local $sDomain = "Encrypted @DOMAIN"

Local $sPassword = "Encrypted PASSWORD"

Local $iLogonFlag = 1

Local $sInstallFile = "dfs path to install file"

Local $sCopySessions = "dfs path to sessions file"

; Run the installation as a user with Admin rights.

RunAsWait ($sUserName, $sDomain, $sPassword, $iLogonFlag, Run($sInstallFile))

Run($sCopySessions)

{END CODE}

By all rights what we have above should work. Any rewrites, help or advice would be greatly appreciated.

Thanks!

;)

Link to comment
Share on other sites

You shouldn't have a Run() function inside of RunAsWait()...

Certifications: A+, Network+, Security+, Linux+, LPIC-1, MCSA | Languages: AutoIt, C, SQL, .NETBooks: AutoIt v3: Your Quick Guide - $7.99 - O'Reilly Media - September 2007-------->[u]AutoIt v3 Development - newbie to g33k[/u] - Coming Soon - Fate Publishing - Spring 2013UDF Libraries: SkypeCOM UDF Library | ADUC Computers OU Cleanup | Find PixelChecksumExamples: Skype COM Examples - Skype4COMLib Examples converted from VBS to AutoIt
Link to comment
Share on other sites

If Not IsAdmin() Then
    RunAs($encryptuser, "***DOMAIN***", $encryptpass, 0, @ScriptName, @ScriptDir);rerun program with admin credentials
    Exit
EndIf

That will rerun your entire script as an admin.

Edited by Distrophy
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...