Global Group Enum From Local ?

P

poi

I have the code below that successfully gives all of the entries in a
local group. But if an entry is a global group, then those users are
not enumerated. How should I modify the code to dig into any global
groups as well?

Thanks.


using System;
using System.Collections;
using System.Runtime.InteropServices;
using System.DirectoryServices;
using ActiveDs;

.....

public string GroupMembers( string userId )
{
string returnVal = "!Default";
string locPath = "WinNT://" +
System.Environment.GetEnvironmentVariable("COMPUTERNAME");

DirectoryEntry localGroup;
localGroup = new DirectoryEntry( locPath + "/LocalGroupTest,group" );

object allMembers = localGroup.Invoke("Members");
foreach (object groupMember in (IEnumerable)allMembers)
{
DirectoryEntry memberEntry = new DirectoryEntry(groupMember);
returnVal += memberEntry.Name + " : ";
}
return returnVal;
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,562
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top