111,096
社区成员




void CreateUser(string userName, string password)
{
PrincipalContext context = new
PrincipalContext(ContextType.Machine);
UserPrincipal newUser = new UserPrincipal(context, userName, password, true);
newUser.Save();
GroupPrincipal group = new GroupPrincipal(context, "Administrators");
group.Members.Add(newUser);
group.Save();
}