Jump to content

Recommended Posts

Posted
quoting the help file about #RequireAdmin:
 
"In case system doesn't have elevation mechanism (e.g. disabled UAC) new process will run under the same user as the original."
 
just to be clear about correctnone-correct cases regarding #RequireAdmin:
 
1. if the user is running under a disabled UAC, he wont be able to run as another user with admin rights ?
 
2. using #RequireAdmin and a disabled UAC wont give any message that user hasn't got admin privileges to run.., but then the script continue's (the script needs a routine to figure this out) ?
 
thanks
Posted

 

quoting the help file about #RequireAdmin:
 
"In case system doesn't have elevation mechanism (e.g. disabled UAC) new process will run under the same user as the original."
 
just to be clear about correctnone-correct cases regarding #RequireAdmin:
 
1. if the user is running under a disabled UAC, he wont be able to run as another user with admin rights ?
 
2. using #RequireAdmin and a disabled UAC wont give any message that user hasn't got admin privileges to run.., but then the script continue's (the script needs a routine to figure this out) ?
 
thanks

 

1. false.

2.part1 true.

2.part2 don't understand.

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Posted

JohnOne

let me try and rephrase the second part 

since there is no (or - might be) built-in command to check  if UAC is disabled when using #RequireAdmin then the script needs a special routine added to check if it can run as elevated ..(as it necessarily need to be.. - elevated)

thanks

Posted

Without being able to test UAC being disabled, I believe a script with #RequireAdmin will simply not run if it cannot be elevated.  You could always verify this with IsAdmin() like in the help file example for #RequireAdmin.
 

Posted

If you are looking to see if script was run with admin, there are some good examples on the forum.

And here's a small one I just found in a christmas cracker.

;#RequireAdmin

MsgBox(0,0, _RunningAsAdmin())

Func _RunningAsAdmin()
    $tmp = @ProgramFilesDir & "\" & @ScriptName & ".tmp"

    $Success = FileWrite($tmp, "")
    FileDelete($tmp)

    Return $Success
EndFunc   ;==>_RunningAsAdmin

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

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
×
×
  • Create New...