Kinook Software Forum

Kinook Software Forum (https://www.kinook.com/Forum/index.php)
-   [VBP] General Discussion (https://www.kinook.com/Forum/forumdisplay.php?f=2)
-   -   How to detect administrator rights under Vista (https://www.kinook.com/Forum/showthread.php?t=3510)

Peter Schregle 03-10-2008 03:51 AM

How to detect administrator rights under Vista
 
In http://www.kinook.com/Forum/showthre...?threadid=2258 you describe how to run Visual Build as an administrator under Vista.

How can I detect if Visual Build is run with administrator rights? I want to fail with an error, if it is run without administrator rights.

Thanks,
Peter

kinook 03-10-2008 07:31 AM

The simplest way would probably be to attempt something that requires admin/elevated privileges (for instance, writing to a registry key/value under HKEY_LOCAL_MACHINE or writing to a file under C:\Program Files) and fail the build if that fails.

Another option would be to call Bill Stewart's isadmin.exe utility (https://westmesatech.com/?page_id=23) or iselevated (https://westmesatech.com/?page_id=49) from a Run Program action. Use a 'Success exit codes' field value of 1 to succeed for elevated admins and fail for unelevated admins and non-admins.


All times are GMT -5. The time now is 07:56 AM.


Copyright © 1999-2023 Kinook Software, Inc.