Click here to Skip to main content
13,195,379 members (60,530 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as


1 bookmarked
Posted 8 Apr 2009

Function to Get the Local System Administrator Name

, 8 Apr 2009
Rate this:
Please Sign up or sign in to vote.
Function to get the local system administrator name

A Codeproject poster asked this question. He was already aware of the NetLocalGroupGetMembers function which can list users in any groups in the system. He wasn't quite sure how to use it and there wasn't any sample code on the internet. So I wrote a sample and posted on CodeProject and here is the copy of it.

DWORD entriesread = 0;
DWORD totalentries = 0;
if( 0 != NetLocalGroupGetMembers( NULL, _T("Administrators"), 1, (LPBYTE*)
                                  &entriesread, &totalentries, 0 ))
      AfxMessageBox( _T("NetLocalGroupGetMembers failed !"));
      return ;
for( DWORD dwIdx =0; dwIdx  < entriesread; dwIdx ++ )
     AfxMessageBox( pstMembersInfo[dwIdx].lgrmi1_name );
NetApiBufferFree( pstMembersInfo );


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Software Developer (Senior)
Singapore Singapore
No Biography provided

You may also be interested in...


Comments and Discussions

General[My vote of 1] Dear Naveen Pin
Ahmad Mahmoud [candseeme]6-Mar-10 20:31
memberAhmad Mahmoud [candseeme]6-Mar-10 20:31 
GeneralRe: [My vote of 1] Dear Naveen Pin
Naveen7-Mar-10 6:08
memberNaveen7-Mar-10 6:08 
GeneralHere is a better problem... Pin
TV Mogul6-Jul-09 4:54
memberTV Mogul6-Jul-09 4:54 
GeneralRe: Here is a better problem... Pin
Naveen6-Jul-09 18:07
mvpNaveen6-Jul-09 18:07 
GeneralGroup names are localized Pin
CowboyDan17-Apr-09 2:46
memberCowboyDan17-Apr-09 2:46 
GeneralRe: Group names are localized Pin
Naveen17-Apr-09 2:54
mvpNaveen17-Apr-09 2:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.171019.1 | Last Updated 8 Apr 2009
Article Copyright 2009 by Naveen
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid