Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Windows administrator?

1 view
Skip to first unread message

Don Gurr

unread,
Nov 21, 2008, 10:34:16 PM11/21/08
to
I need to determine if a specified user is a Windows administrator. I need
this to work with and without domains. I tried using NetUserGetInfo, but I
can't get it to work with domains. Should NetUserGetInfo work with domains?
Is there a different approach that I should consider?


Christian ASTOR

unread,
Nov 22, 2008, 6:43:47 AM11/22/08
to
Don Gurr wrote:

CheckTokenMembership() or SHTestTokenMembership
or IsUserAnAdmin()
or KB118626 for current user

Don Gurr

unread,
Nov 24, 2008, 8:10:35 PM11/24/08
to
I believe these routines only check the currently logged on user. I need to
check other users also.

"Christian ASTOR" <cast...@club-internet.fr> wrote in message
news:4927f06e$0$28668$7a62...@news.club-internet.fr...

Christian ASTOR

unread,
Nov 25, 2008, 7:09:44 AM11/25/08
to
Don Gurr wrote:
> I believe these routines only check the currently logged on user. I need to
> check other users also.

No, you can pass a User Token (after a DuplicateToken())

Don Gurr

unread,
Nov 27, 2008, 2:10:57 PM11/27/08
to
Any idea where can I get some sample code?

"Christian ASTOR" <cast...@club-internet.fr> wrote in message

news:492beb01$0$28676$7a62...@news.club-internet.fr...

Christian ASTOR

unread,
Nov 27, 2008, 9:43:12 PM11/27/08
to
Don Gurr wrote:
> Any idea where can I get some sample code?

I can post a sample, but you must call LogonUser() to get a User Token
Then the simplest method for a given user is with
NetUserGetLocalGroups() (or also NetLocalGroupGetMembers())

0 new messages