Can't determine group membership for local machine
Mont Rothstein <[email protected]>
| Newsgroups | gmane.comp.windows.devel.dotnet.cx |
|---|---|
| Message-ID | <[email protected]> |
I am trying to determine is a user is a member of the Administrators group
(so I know whether to add them or not), but I can't seem to get it working.
I'm using the following code:
DirectoryEntry group;
group = new DirectoryEntry("WinNT://" +
Environment.MachineName+ "/" + "Administrators");
bool retVal = (bool)group.Invoke("IsMember", new object[] {
"WinNT://" + Environment.MachineName + "/" + userName });
retVal is always false. I've tested for every user in the group.
I am a local administrator. Might I not have some permission that I need?
Thanks,
-Mont
===================================
This list is hosted by DevelopMentor® http://www.develop.com
View archives and manage your subscription(s) at http://discuss.develop.com