写入Active Directory时出现问题 [英] Problems writing to Active Directory
问题描述
我正在尝试使用c#将OU添加到Active Directory中.我有以下代码应根据我在互联网上找到的信息工作.有人知道怎么了吗?
I am trying to add OUs to Active Directory programatically using c#. I have the following code which should work according to info I found on the internet. Does anyone know whats wrong?
DirectoryEntry条目=新的DirectoryEntry(" LDAP://ipaddress/DC = domainname,dc = com " ,管理员",密码");
DirectoryEntry entry = new DirectoryEntry("LDAP://ipaddress/DC=domainname,dc=com", "administrator", "password");
entry.Children.Add("OU = newOU","OrganizationalUnit");
entry.Children.Add("OU=newOU", "OrganizationalUnit");
entry.CommitChanges();
entry.CommitChanges();
它可以编译并正常运行,但是不会创建OU.有任何建议吗?
It compiles and runs fine but however no OU is created. Any suggestions?
推荐答案
可以请检查eventviewer或ActiveDirectory吗?让我知道是否发现任何错误或警告?
Can you please check the eventviewer or ActiveDirectory?Let me know if you find any errors or warning?
这篇关于写入Active Directory时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!