Jump to content
Sign in to follow this  

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

Recommended Posts


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?



Edited by wslh

Share this post

Link to post
Share on other sites

IsAdmin() maybe.

I don't think so. If you haven't escalated privileges it returns false. And if the script was compiled with #RequireAdmin it can't run without Admin privileges.

Share this post

Link to post
Share on other sites

I had it in my head that this would work.

If IsAdmin() Then

While 1

Of course though, it does not.

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


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).

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...