Jump to content
Sign in to follow this  

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:


; 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))



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



Share this post

Link to post
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

Share this post

Link to post
Share on other sites

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

That will rerun your entire script as an admin.

Edited by Distrophy

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