string ouString = projectBox.Text.ToString();
string parentName = "LDAP://OU="+ouString+",OU=Clients,OU=Clients,DC=domain,DC=net";
DirectoryEntry parentEntry = new DirectoryEntry(parentName);
DirectoryEntry newGroup = parentEntry.Children.Add("CN=" + ouString+"SecGroup", "group");
newGroup.Properties["member"].Add("ExistingGroup");
newGroup.CommitChanges();
newGroup.Dispose();
parentEntry.Dispose();
throws the exception:
The server is unwilling to process the request at newGroup.CommitChanges(); Any thoughts?
There is not a password issue, I believe it might have to do with no finding "ExistingGroup". If i comment out newGroup.Properties["member"].Add("ExistingGroup"); it'll create the sec group just fine. I'm trying to create a new Security group and make it a member of another group at the same time.
newGroup.Properties["member"].Add("CN=Clients Clients,OU=Clients,DC=domain,DC=net");
You have to fully qualify the groups location....
But this does the opposite. It makes ExistingGroup a member of the newGroup, i want visa versa...
我稍后再回来,然后也许是更好的代码
Check your domain password policies.
http://www.computerperformance.co.uk/Logon/code/code_80072035.htm
"One possibility is that you trying to enable or 'set' a user account. The problem is that the account must have a password and none is provided. Another possibility is that your domain policy requires a complex password."
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.