Orchestrator executable with auto run with admin rights

dev-linux
Ivan Maslov 4 years ago
parent 1c415a34cb
commit 3585cb3946

@ -1,4 +1,3 @@
cd %~dp0
copy /Y ..\Resources\WPy64-3720\python-3.7.2.amd64\python.exe ..\Resources\WPy64-3720\python-3.7.2.amd64\pyOpenRPA_Orchestrator.exe
.\..\Resources\WPy64-3720\python-3.7.2.amd64\pyOpenRPA_Orchestrator.exe "OrchestratorSettings.py"
pause >nul

@ -1,2 +0,0 @@
cd %~dp0
start pyOpenRPA.Orchestrator_x64_administrator.lnk

@ -1,4 +1,4 @@
import subprocess, json, psutil, time, os, win32security, sys, base64, logging #Get input argument
import subprocess, json, psutil, time, os, win32security, sys, base64, logging, ctypes #Get input argument
from . import Server
from . import Timer
from . import Processor
@ -807,7 +807,17 @@ from .. import __version__ # Get version from the package
# Main def for orchestrator
def Orchestrator(inGSettings):
lL = inGSettings["Logger"]
# https://stackoverflow.com/questions/130763/request-uac-elevation-from-within-a-python-script
def is_admin():
try:
return ctypes.windll.shell32.IsUserAnAdmin()
except:
return False
if not is_admin():
# Re-run the program with admin rights
ctypes.windll.shell32.ShellExecuteW(None, "runas", sys.executable, " ".join(sys.argv), None, 1)
else:
# Code of your program here
#mGlobalDict = Settings.Settings(sys.argv[1])
gSettingsDict = inGSettings # Alias for old name in alg
inGSettings["VersionStr"] = __version__

Loading…
Cancel
Save