Archive: detecting administrator


detecting administrator
Hello,

I would like to detect if the user who is logged in and running a NSIS-installer has administrator priviliges.
Is there any way to do this?

Regards,
David Lofstrand


i think that function is built in to nsis if you are using WIN2K, but i would have to check


Try to write a value to HKLM, if that works, the user had Power User rights.


Thanks for the proposal but I still need to find out if the user is an Administrator.
The thing is that I'm executing a 3rdparty installer (ExecWait "install_driver.exe") and his installer requires Administrator rights since it's installing a driver.
A Power User works for my own installation but the 3rdparty installer requires Administrator rights.


Originally posted by Joost Verburg
Try to write a value to HKLM, if that works, the user had Power User rights.

The installer must work for Win2K and WinNT
If you're right I really would like to know what builtin function I should use.

Originally posted by bballer182
i think that function is built in to nsis if you are using WIN2K, but i would have to check

Administrator detection is possible with Windows API, so you can write a small program for it.


Win APi function
Hi,

What windows function must be used to detect it ?

Greetings,
Andreas


Which programming language?

You can use:

NetUserGetInfo
NetApiBufferFree
MoveMemory


You are referring to the Win32 API, right?
Is it possible to perform a query about the user rights in NSIS?


Originally posted by Joost Verburg
Which programming language?

You can use:

NetUserGetInfo
NetApiBufferFree
MoveMemory

Yes, Win32 API. Detecting an Administrator is not one simple API call, it requires some code. You should write a small application for it, it's not possible with NSIS Scripts.