IsUserAnAdmin function
Tests whether the current user is a member of the Administrator's group.
Syntax
BOOL IsUserAnAdmin(void);
Parameters
This function has no parameters.
Return value
Type: BOOL
Returns TRUE if the user is a member of the Administrator's group; otherwise, FALSE.
Remarks
This function is a wrapper for CheckTokenMembership. It is recommended to call that function directly to determine Administrator group status rather than calling IsUserAnAdmin.
Note This function is available through Windows Vista. It might be altered or unavailable in subsequent versions of Windows.
Requirements
|
Minimum supported client | Windows 2000 Professional |
|---|---|
|
Minimum supported server | Windows 2000 Server |
|
Header |
|
|
Library |
|
|
DLL |
|
See also
Send comments about this topic to Microsoft
Build date: 9/7/2011
Not supported on Windows 2000
The minimum supported client is incorrect. There is no DLL entry point for IsUserAnAdmin in Shell32.dll of Windows 2000 Professional (SP4). Not checked on Windows Server 2000, but mostly it wont work either.
- 11/21/2011
- Shreyas Zare
C# syntax
[DllImport("shell32.dll")]
public static extern bool IsUserAnAdmin();
if(IsUserIsAnAdmin()){
MessageBox.Show("User is Admin");
}
else {
MessageBox.Show("Not a Admin");
}
- 4/22/2009
- dmex
- 1/27/2011
- feuerblitz03
