Aug 22, 2011

Function: IsRunAsAdministrator

There are many ways to check if user has administrative privileges or not. In this example it is attempted to write to default registry value in the WBEM key, what requires elevated privileges. The write succeeds if invoker has sufficient privileges and fails if one has not such.
reg add "HKLM\SOFTWARE\Microsoft\WBEM" /v "" /d "" /f>nul 2>&1||exit/b1

No comments:

Post a Comment