wslh Posted November 17, 2010 Share Posted November 17, 2010 (edited) 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? 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 November 17, 2010 by wslh Link to comment Share on other sites More sharing options...
JohnOne Posted November 17, 2010 Share Posted November 17, 2010 IsAdmin() maybe. 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 More sharing options...
wslh Posted November 17, 2010 Author Share Posted November 17, 2010 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. Link to comment Share on other sites More sharing options...
JohnOne Posted November 17, 2010 Share Posted November 17, 2010 (edited) 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 November 17, 2010 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 More sharing options...
aef03 Posted December 21, 2010 Share Posted December 21, 2010 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 More sharing options...
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