0

I have a Windows application where I ideally want to give certain functionality to certain levels of system security. This is already in place for admin vs non admin and this was easy enough, but say I had 3 network groups defined like "Security1", "Security2", "Security3", is there a way that I could tell if the current user running the application is a member of one of these groups?

I have looked around but all I can find is for determining the membership of a well-known group as this group has a well-known SID.

So is there any way to do this for custom groups?

Thanks in advance!

bd99
  • 57
  • 1
  • 1
  • 8

1 Answers1

0

I'm not sure if this is what you're looking for, but if you can get the user name of the current user (which should be fairly easy if the application isn't a service), you should be able to query with

net user <userName> /domain | find "Group"

How to execute a command and get output of command within C++ using POSIX? Describes how to execute a command from C++.

To debug:

net user [username] /domain
net user [username]

Check which of those is what you're looking for.

Community
  • 1
  • 1
Rahul Manne
  • 1,229
  • 10
  • 20
  • I have tried this on mine and a colleague's account and it is what I need but seems to only list one global group membership on each of us, where I would expect more to be listed. Is there some parameter you need to add to list all? Thanks for the reply! – bd99 Dec 19 '14 at 08:34
  • Hmm, try net user without the /domain. The /domain is if your accounts are network accounts. – Rahul Manne Dec 20 '14 at 20:43