Sign in to follow this  
Followers 0
bdwilcox

RunAs refuses to start OpenVPN GUI

5 posts in this topic

#1 ·  Posted (edited)

The OpenVPN GUI needs to be run as an Admin but our users run as straight up users.  I tried to use AutoIt to run the OpenVPN GUI as Administrator using the following script:

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Compression=4
#AutoIt3Wrapper_Compile_Both=y
#AutoIt3Wrapper_UseX64=y
;#AutoIt3Wrapper_Res_requestedExecutionLevel=requireAdministrator
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.3.14.2
 Author:         myName

 Script Function:
    Template AutoIt script.

#ce ----------------------------------------------------------------------------

; Script Start - Add your code below here
RunAs("administrator", @ComputerName, "blah.blah.password", 0, '"C:\Program Files\OpenVPN\bin\openvpn-gui.exe"')

Unfortunately, I run this and it doesn't do anything (no error - it just flashes in the system tray and disappears).  I replaced the program path in the command with '"C:\windows\notepad.exe"' and Notepad starts without issue so I'm not sure what's going on with it.  To troubleshoot, I compiled the above script into both 32 and 64 bit executables and tried running them as the user as well as Administrator and it doesn't do anything.  I also tried running the script under the Administrator account and same thing.  I then ran the path in Windows' Run dialogue box and it started the executable no problem.  Any ideas why this script won't kick off the openvpn-gui executable?

Edited by bdwilcox

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Hi,

Can you try this code below?

#RequireAdmin

Run("openvpn-gui.exe", "C:\Program Files\OpenVPN\bin")

EDIT:

I use this approach in case run does not work
 

#RequireAdmin

ShellExecute("openvpn-gui.exe", "", "C:\Program Files\OpenVPN\bin")

 

Edited by cres

Share this post


Link to post
Share on other sites

#3 ·  Posted

Though both scripts you provided successfully start the OpenVPN GUI, they defeat the purpose as both demand Admin credentials in order to run.  Instead, I was hoping to embed the Admin's credentials within the compiled executable by using the RunAs command.  This way, users wouldn't need to feed the OpenVPN GUI the Admin credentials it requires to run instead relying on the credentials already within the AutoIt compiled EXE.

Share this post


Link to post
Share on other sites

#4 ·  Posted

Anyone have any ideas why the RunAs isn't working?

Share this post


Link to post
Share on other sites

#5 ·  Posted

Nevermind, I just used RunAsTool

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