Shell Functions


IsUserAnAdmin Function

Tests whether the current user is a member of the Administrator's group.

Syntax

BOOL IsUserAnAdmin(VOID);

Return Value

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

Function Information

Minimum DLL Versionshell32.dll version 5.0 or later
Custom ImplementationNo
Headershlobj.h
Import libraryshell32.lib
Minimum operating systems Windows 2000

See Also

Tags :


Community Content

dmex
vb.net syntax
<DllImport("shell32.dll", EntryPoint:="IsUserAnAdmin")> Public Shared Function IsUserAnAdmin() As Boolean
End Function

If IsUserAnAdmin = False Then
MessageBox.Show("Not a Admin")
ElseIf IsUserAnAdmin = True Then
MessageBox.Show("User is Admin")
End If

Tags :

dmex
C# syntax
[DllImport("shell32.dll")]
public static extern bool IsUserAnAdmin();
Tags :

Page view tracker