Jump to content

How to handle different behavior if user can/can't escalate privileges with #RequireAdmin?


wslh
 Share

Recommended Posts

Hi,

I would like to run my AutoIt script in two scenarios with different behaviour:

i) With #RequireAdmin

ii) Without #RequireAdmin if user can't escalate privileges.

a) How can I do that since the RequireAdmin affects the .exe manifest?

:graduated: And also how can I verify if the user can escalate privileges?

I was thinking in packing two exes for (a), but don't know how to do (:(. There is other way to accomplish it?

Thanks,

wslh

Edited by wslh
Link to comment
Share on other sites

I had it in my head that this would work.

If IsAdmin() Then
    #RequireAdmin
EndIf

While 1
    sleep(20)
WEnd

Of course though, it does not.

Edited by JohnOne

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

  • 1 month later...

I had it in my head that this would work.

If IsAdmin() Then
    #RequireAdmin
EndIf

While 1
    sleep(20)
WEnd

Of course though, it does not.

The operating system already handles this with the manifest level "highestAvailable" - so use this in your script:

#AutoIt3Wrapper_res_requestedExecutionLevel=highestAvailable

It will prompt for admin if the user can give it, otherwise it will run as a regular user. Will also selectively display the shield. (#RequireAdmin relaunches as admin, so it does not display the shield).

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...