vanquish12 Posted September 8, 2011 Share Posted September 8, 2011 Hello, everyone. I have a longish system setup and configuration AutoIt script that needs to run in fully automatic mode (no user intervention except for the moment the script is started). Parts of the script need administrator privileges, but other parts must be run under the current user account, and these parts are mixed. My impression so far is that #RequireAdmin cannot be reversed when I no longer need it in my script. So everything there is runs with admin privileges, and I get invalid results. Should I try to use things like RunAs, then, or maybe divide the script into many small scripts and run those from an external batch file, so that #RequireAdmin won't spoil the execution of non-admin parts? Is there a better way? Any ideas are appreciated. Thanks. Link to comment Share on other sites More sharing options...
ZacUSNYR Posted September 8, 2011 Share Posted September 8, 2011 (edited) #RequireAdmin will check to see if the user launching the script is admin, if they are not you'll be prompted for a user account who is. If none is provided the script terminates. What you're looking for is IsAdmin to do checks during a script. You'll want to use RunAs to elevate permissions. If IsAdmin() Then RunAs.... etc.. Edited September 8, 2011 by ZacUSNYR 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