Jump to content

IsAdmin() issues


Recommended Posts

I have an AutoIt application that checks for administrator rights with IsAdmin(). When the user has them, the application is allowed to update its configuration with IniWrite(), otherwise not. However, with Vista I'm running into problems as the UAC doesn't popup and IsAdmin() always returns FALSE.

I cannot use #RequireAdmin as restricted users can then not use the application anymore (right?)

I cannot simply write and hope that with a restricted user this will fail, as XP with FAT32 writing will work.

So how can I let the application check if what type of user is used?

jacQues

Link to comment
Share on other sites

Hi.

I needed something like this recently, have a look at this thread I started, I've posted what I use there.

Steph

That's nice if you have only English Windows Installations. In German e.g. the "Administrators" is "Administratoren", other localizations have even more different names.

Also it's possible to rename the group "Administrators" to whatever you like...

As the "Administrators" is a build in Group I can imagine, that they have something like Group-ID "0", so that that there might be some WinApi/DLL call getting a info like "Tell me if User <name> is member of <Build-in-Admins-Group>".

Anybody who knows about that?

Regards, Rudi.

Earth is flat, pigs can fly, and Nuclear Power is SAFE!

Link to comment
Share on other sites

That's nice if you have only English Windows Installations. In German e.g. the "Administrators" is "Administratoren", other localizations have even more different names.

Aaaarrgh! Back to square one. :-(

Silly question, would a RegWrite() trigger the UAC popup to appear on Vista? (But not quit the AutoIt software if canceled). I could simply do something like this:

FUNC IsAdminUser()

RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\IsAdminUserTest","RandomValue","REG_DWORD",Random(1,4294967295,1))

RETURN IsAdmin()

ENDFUNC

Just a wild idea... Got XP here and no good way to test anything Vista.

Link to comment
Share on other sites

Hi.

FUNC IsAdminUser()

RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\IsAdminUserTest","RandomValue","REG_DWORD",Random(1,4294967295,1))

RETURN IsAdmin()

ENDFUNC

Just a wild idea... Got XP here and no good way to test anything Vista.

Well, as you want something for Vista I assume that you will have Vista "nearby", so pls. test it and let us know your results :)

Regards, Rudi.

Earth is flat, pigs can fly, and Nuclear Power is SAFE!

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