Click to Rate and Give Feedback
MSDN
MSDN Library
User Interface
Windows Shell
Shell Reference
Shell Functions
 IsUserAnAdmin Function

  Switch on low bandwidth view
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 What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
vb.net syntax      dmex   |   Edit   |   Show History
<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 What's this?: Add a tag
Flag as ContentBug
C# syntax      dmex   |   Edit   |   Show History
[DllImport("shell32.dll")]
public static extern bool IsUserAnAdmin();
Tags What's this?: Add a tag
Flag as ContentBug
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker