static void Main(string[] args)
{
DirectoryEntry localMachine = new DirectoryEntry("WinNT://" + Environment.MachineName + ",Computer");
DirectoryEntry admGroup = localMachine.Children.Find("Users");
object members = admGroup.Invoke("members", null);
foreach (object groupMember in (IEnumerable)members)
DirectoryEntry member = new DirectoryEntry(groupMember);
Console.WriteLine(member.Name);
Console.ReadLine();
}
在输出中,我得到了“用户”下的本地帐户列表。但是内置的来宾帐户没有显示出来。