如何以编程方式在.NET中的Active Directory域和信任添加UPN后缀? [英] How to programmatically add UPN Suffix in Active Directory Domains and Trusts in .NET?
问题描述
我想问题的标题基本上概括起来。手动,我会打开Active Directory域和信任,右击资源管理器树的顶端节点,并添加域UPN后缀。
I think the Question title basically sums it up. Manually, I would open Active Directory Domains and Trusts, right click on top node in Explorer tree, and add domain UPN suffix.
推荐答案
当然。您需要修改的 CN =分区,CN =配置,DC =林,DC = COM
对象upnSuffixes属性。请记住,有大约1300的值保存在有一个粗略的限制。
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.
这样的事情应该工作 - 只是写了code。在文本框中,但这样可能需要一些调整:
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();
这篇关于如何以编程方式在.NET中的Active Directory域和信任添加UPN后缀?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!