bdwilcox Posted March 16, 2017 Posted March 16, 2017 (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 March 16, 2017 by bdwilcox
cres Posted March 16, 2017 Posted March 16, 2017 (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 March 16, 2017 by cres
bdwilcox Posted March 16, 2017 Author Posted March 16, 2017 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.
bdwilcox Posted March 16, 2017 Author Posted March 16, 2017 Anyone have any ideas why the RunAs isn't working?
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now