1

background:

I want to run ESET Internet Security gui file from python as admin. It is named egui.exe. So in it's properties, under compatibility, I checked "run this program as an administrator" check box so it always run's as admin.

Another note is that for some reason that seems to be beyond me if I run this file in python like this:

os.startfile("c:\\program files\\ESET\\ESET Security\\egui.exe")

or

os.system("c:\\program files\\ESET\\ESET Security\\egui.exe")

It will freeze and do nothing. i tested the same approach in CMD like these:

c:\Program Files\ESET\ESET Security>egui.exe
c:\Program Files\ESET\ESET Security>start egui.exe

But both of these will cause CMD to freeze and do nothing and even ctrl + c will not interrupt it and CMD should be closed.

what I did:

The approach that somehow works is running the exe file via explorer.exe:

os.system('explorer.exe "c:\\program files\\ESET\\ESET Security\\egui.exe"')

This will not freeze but the problem is that because I want egui.exe to be run as admin, it will trigger UAC prompt, which is not acceptable because the program is supposed to be a test using GUI Automation.

Question:

I can run other programs as admin without triggering UAC prompt when my program itself is run as admin. But I cant when running it via explorer.exe and I think it is because explorer.exe is not as admin itself. So the question is how can I run explorer.exe as admin? Also entering password every time is not acceptable for obvious reasons.

PS: Unfortunately there is no compatibility setting for explorer.exe in its properties.

piko
  • 11
  • 2
  • 1
    Possible duplicate of [How to run python script with elevated privilege on windows](https://stackoverflow.com/questions/19672352/how-to-run-python-script-with-elevated-privilege-on-windows) – neau May 08 '19 at 09:08

0 Answers0