Darien Posted September 19, 2017 Share Posted September 19, 2017 Hello, How to know if a script was run as administrator? (right-click and choose "run as administrator") The "Isadmin" command only shows whether the logged account has administrator rights. Link to comment Share on other sites More sharing options...
Developers Jos Posted September 19, 2017 Developers Share Posted September 19, 2017 13 minutes ago, Darien said: The "Isadmin" command only shows whether the logged account has administrator rights. Are you sure? Strait from the helpfile: Quote Remarks It returns 1 under Windows Vista only if running with a full administrator token (i.e. #RequireAdmin has been used, or has already been elevated by UAC). Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Darien Posted September 19, 2017 Author Share Posted September 19, 2017 The parentheses were missing. Funny not to have accused any error. Link to comment Share on other sites More sharing options...
spudw2k Posted September 21, 2017 Share Posted September 21, 2017 I imagine this has something to do with it (first section in regards to functions being, "...first class objects")https://www.autoitscript.com/autoit3/docs/function_notes.htm Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX Builder Misc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retrieve SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose Array Projects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalc Cool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF Link to comment Share on other sites More sharing options...
Elena Posted September 29, 2017 Share Posted September 29, 2017 Hi, I'm Windows10 user. Sorry if this is an out of topic question, but what should I do with my user account to get administrative rights? My User Account Control is set to 'Never Notify' level, and current user is a member of 'Administrators' group. But when I use IsAdmin () script from example, it shows that I'm not an Admin: If IsAdmin() Then MsgBox($MB_SYSTEMMODAL, "", "IsAdmin" & @CRLF & "Admin rights are detected.") Else MsgBox($MB_SYSTEMMODAL, "", "IsAdmin" & @CRLF & "Admin rights are NOT detected.") EndIf As it returns 'No Admin' rights, I should use #RequireAdmin to correctly script running. ConsoleWrite() doesn't work in that case, it's not convenient. Can I redirect Console notes to a file? Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted September 29, 2017 Moderators Share Posted September 29, 2017 7 minutes ago, Elena said: ConsoleWrite() doesn't work in that case, it's not convenient. As the help file states, you're opening a new process which is why ConsoleWrite does not work. If you want these functions, you will need to launch SciTE as an administrator as well. 9 minutes ago, Elena said: Can I redirect Console notes to a file? A quick search of the forum will show you a multitude of ways to log your script's activities, from log files to the Windows Event Viewer. Choose the one that best suits your needs. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
Elena Posted September 29, 2017 Share Posted September 29, 2017 Thank you for suggestion! Running SciTE as administrator is OK. Link to comment Share on other sites More sharing options...
Graeme Posted November 2, 2017 Share Posted November 2, 2017 I have the opposite problem... the script is elevated, I used #requireadmin and so, if I understand correctly I've started a new process as user Admin. Is there any way to know whether the user that started the script, before it was elevated (or closed and run as administrator) had admin rights. I suppose another way of looking at this is, is there a way of know whether it was elevated or if it ran as normal because the user who started it already had admin rights? Clear as mud? Link to comment Share on other sites More sharing options...
Developers Jos Posted November 2, 2017 Developers Share Posted November 2, 2017 49 minutes ago, Graeme said: I used #requireadmin and so This will only prompt to elevate when it isn't running yet with Admin rights, so there is your answer. Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Graeme Posted November 2, 2017 Share Posted November 2, 2017 Sounds good.... However the program is testing all kinds of things in a computer to make sure it's ready for company business. So I put all the results from the tests in a splash text... I want to say, Yes or No that the account that started the script has admin rights... can the script tell if the UAC was invoked??? The user can tell and in a way I'm happy with that but it would be nice if the script could as well.. Link to comment Share on other sites More sharing options...
Developers Jos Posted November 2, 2017 Developers Share Posted November 2, 2017 What exactly do you want to test? DO you want to know whether the user has Administrator right (is part of the Local Administrators group) as that is a different question from whether the UAC is enabled? Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Graeme Posted November 2, 2017 Share Posted November 2, 2017 What I actually want to test is whether the user has admin rights... From what I've seen before, as soon as I run a script with #requireadmin, the user for that instance is admin and so has admin rights.. What I want to know is whether the user who started the script had admin rights... Link to comment Share on other sites More sharing options...
Earthshine Posted November 2, 2017 Share Posted November 2, 2017 maybe this https://www.autoitscript.com/autoit3/docs/functions/IsAdmin.htm google you own workds: " test is whether the user has admin rights autoit" i did that and got that hit, first thing. So, you call that function to determine if they have rights My resources are limited. You must ask the right questions Link to comment Share on other sites More sharing options...
Graeme Posted November 2, 2017 Share Posted November 2, 2017 Thanks Earthshine but the problem is that there are two users. When you call #requireadmin the system closes the process and opens a new one in the user admin which has admin rights... I want to know about the first user, not the second..:( 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