How to programmatically add UPN Suffix in Active Directory Domains and Trusts in .NET?
I think the Question title basically s开发者_JAVA百科ums it up. Manually, I would open Active Directory Domains and Trusts, right click on top node in Explorer tree, and add domain UPN suffix.
Sure. You need to modify the upnSuffixes attribute of the CN=Partitions,CN=Configuration,DC=ForestRootDomain,DC=com
object. Keep in mind there's a rough limit of about 1300 values stored in there.
Something like this should work - just wrote the code in the textbox though so might need a bit of tweaking:
DirectoryEntry partitionsContainer = new DirectoryEntry("LDAP://CN=Partitions,CN=Configuration,DC=ForestRootDomain,DC=com");
partitionsContainer["upnSuffixes"].Add("foosuffix.net");
partitionsContainer.CommitChanges();
精彩评论