I have a piece of code that creates a Windows user. Everything is fine and the user is indeed created. However, when I try to pinvoke LoadUserProfile, the operation fails, because the user is not in the Users group. Now, I know how to pragmatically add this user to the Users group, but I dont want to hard-code group name "Users", since it might change depending on the locale. Is there a way to add the user to the Users group by default (by the way, runas user /add command already does that)?
DirectoryEntry dirEntry = new DirectoryEntry("WinNT://" + domain);
DirectoryEntries entries = dirEntry.Children;
DirectoryEntry user = entries.Add(username, "User");
user.Properties["FullName"].Add("Dr Zoidberg");
user.Invoke("SetPassword", password);
user.CommitChanges();