Jump to content

IsAdmin() + Vista


Recommended Posts

I use vista on an admin acc.... and this doesnt give me the message box :D

If IsAdmin() Then MsgBox(0, "", "Admin rights detected")

but the actual code I am working with is:

If $Pass = $Password Then
        If Not IsAdmin() Then
            MsgBox(0, "Problem...", "The settings cannot open because you are not a computer administrator...")
            endscript()
        Else
            ShellExecute($Location & "Settings.exe")
            endscript()
        EndIf
    Else
        Run(@AutoItExe & ' /AutoIt3ExecuteLine  "MsgBox(48, ''Incorrect Password!'', ''An incorrect password was used!'' & @CRLF & ''The program will continue to run.'')"')
    EndIf

which always gives the message "The settings cannot open because you are not a computer administrator..."

Edited by ReaImDown
[u][font="Century Gothic"]~я α и d γ ĵ . ċ . ѕ қ ϊ и и ε я~- My Programs -auto shutdownSleep funcdisallow programs[/font][/u]
Link to comment
Share on other sites

Do you have UAC enabled? Try adding #RequireAdmin if you want to run it as admin.

am trying to make 1 program execute another...ONLY IF the account is an admin account....if not, I dont want it to execute the other program, and give the user notice.

I do believe uac is disabled... but either way....

if IsAdmin() then msgbox(0,"","")

should give me the message box because I am an admin.

[u][font="Century Gothic"]~я α и d γ ĵ . ċ . ѕ қ ϊ и и ε я~- My Programs -auto shutdownSleep funcdisallow programs[/font][/u]
Link to comment
Share on other sites

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).

^ from help file

must of missed that -.-' sorry... is there any way of doing this w/e #RequireAdmin... I dont want the script in question to require admin... but I need the second script to.

[u][font="Century Gothic"]~я α и d γ ĵ . ċ . ѕ қ ϊ и и ε я~- My Programs -auto shutdownSleep funcdisallow programs[/font][/u]
Link to comment
Share on other sites

am trying to make 1 program execute another...ONLY IF the account is an admin account....if not, I dont want it to execute the other program, and give the user notice.

I do believe uac is disabled... but either way....

if IsAdmin() then msgbox(0,"","")

should give me the message box because I am an admin.

You're missing the point here, unless you are using #RequireAdmin you are not really an admin. This is due to the new security added in Vista.
Link to comment
Share on other sites

You're missing the point here, unless you are using #RequireAdmin you are not really an admin. This is due to the new security added in Vista.

gotchya, so I will need to write a new script to execute the other script...or just let it slide w/o any admin rights....thank you

[u][font="Century Gothic"]~я α и d γ ĵ . ċ . ѕ қ ϊ и и ε я~- My Programs -auto shutdownSleep funcdisallow programs[/font][/u]
Link to comment
Share on other sites

If you Right-Click an Executable and 'Run as Administrator', you don't need a #RequireAdmin keyword in your script, IsAdmin() will then work as expected.

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...