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();
}
在输出中,我将获得"用户"下的本地帐户列表。但是内置的Guest帐户未显示。
答案 0 :(得分:1)
您可以使用NetUserSetInfo函数更改用户帐户的用户名。