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;
}
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;
}