JerryD Posted August 12, 2008 Posted August 12, 2008 I have a script which performs several installations. It has the #RequireAdmin directive, and works fine under Vista. However, the other day a tech ran the compiled script by right clicking the EXE and selecting "Run as Administrator", and for whatever reason, the script just hung. As the script works fine if that isn't done, what I'd like to do is to determine if the script was run by right clicking on the EXE and selecting Run as Administrator so that I can put up an error message and exit the script if it's done again. I tried looking at the system variables, but they don't change. Any other suggestions for how to detect this situation? Thanks. Jerry
Xenobiologist Posted August 12, 2008 Posted August 12, 2008 Hi, maybe you can check whether the user loggedin is admin. If not, it was a right-click-run. Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times
Paulchen Posted August 12, 2008 Posted August 12, 2008 I use ;~ #RequireAdmin #Include <Misc.au3> $stxt=_Iif(IsAdmin() = 1, "Yes", "no") MsgBox(0,"Admin rights", $stxt)
JerryD Posted September 3, 2008 Author Posted September 3, 2008 I use;~ #RequireAdmin#Include <Misc.au3>$stxt=_Iif(IsAdmin() = 1, "Yes", "no")MsgBox(0,"Admin rights", $stxt)That would probably work if the users weren't in the Administrators group, but when they are, it just always says Yes.The problem is knowing if it's being run with Elevated Administrator level privledges (not just Administrator level) BEFORE the rights are elevated by the #RequireAdmin directive.I suspect this is not possible, and I'll just have to put a warning message up first.Thanks though!
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