L
localhost
This code enumerates all local group members
(Win2K web server member server in a
Win2K domain). But if a member
is a global group, I need to
know it. Currently I can't tell
if the entry in the local
group is a user or a global.
How to tell the difference?
Thanks.
string localGroupName = "":
string bV = "";
string locPath = "WinNT://" +
System.Environment.GetEnvironmentVariable
( "COMPUTERNAME" );
DirectoryEntry localGroup;
try
{
localGroup = new DirectoryEntry( locPath + "/" +
localGroupName + ",group" );
object allMembers = localGroup.Invoke( "Members" );
foreach ( object groupMember in (IEnumerable)
allMembers )
{
DirectoryEntry memberEntry = new DirectoryEntry(
groupMember );
bV += memberEntry.Path.ToLower().Replace( "/",@"\" )
+ ":";
}
}
catch( System.Runtime.InteropServices.COMException
xxxCom )
{
bV = xxxCom.ToString();
}
return bV;
(Win2K web server member server in a
Win2K domain). But if a member
is a global group, I need to
know it. Currently I can't tell
if the entry in the local
group is a user or a global.
How to tell the difference?
Thanks.
string localGroupName = "":
string bV = "";
string locPath = "WinNT://" +
System.Environment.GetEnvironmentVariable
( "COMPUTERNAME" );
DirectoryEntry localGroup;
try
{
localGroup = new DirectoryEntry( locPath + "/" +
localGroupName + ",group" );
object allMembers = localGroup.Invoke( "Members" );
foreach ( object groupMember in (IEnumerable)
allMembers )
{
DirectoryEntry memberEntry = new DirectoryEntry(
groupMember );
bV += memberEntry.Path.ToLower().Replace( "/",@"\" )
+ ":";
}
}
catch( System.Runtime.InteropServices.COMException
xxxCom )
{
bV = xxxCom.ToString();
}
return bV;