创建用户在PDC时出错0x800706BA。有没有人seeen前? [英] Error 0x800706BA when creating user in a PDC. Has anyone seeen it before?
本文介绍了创建用户在PDC时出错0x800706BA。有没有人seeen前?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图创建使用以下code段的新用户。
I'm attempting to create a new user using the following code snippet.
using (var ad =
new PrincipalContext(ContextType.Domain,
"<domain>",
"<ad user>",
"<ad pass>"))
{
using (var aduser = new UserPrincipal(ad, "dummy", "password", false))
{
aduser.Save();
}
}
不过,我得到的消息 RPC无法
与 0x800706BA
错误code。
有没有人见过吗?
和,更importat,解决了这个问题!
And, more importat, solved it!
推荐答案
尽管通过.NET 3.5中提供的AccountManagement接口,用于我的问题没有工作,回落至忠实LDAP工作。所以我在这里张贴后人。
Although the AccountManagement interfaces provided by .NET 3.5 didn't work for my issue, falling back to the faithful LDAP worked. So I'm posting here to posterity.
/*
* First we need to create the user...
*/
using (var dirEntry = new DirectoryEntry("LDAP://<IP/name>",
"<admin>",
"<admin pass>",
AuthenticationTypes.ServerBind))
{
using (var newUser = dirEntry.Children.Add("CN=dummy", "user"))
{
newUser.Properties["samAccountName"].Value = "dummy";
newUser.CommitChanges();
}
}
/*
* Then set its password!
*
* If the password is set in the same
* transaction as the creation an error occurr.
*/
using (var user = new DirectoryEntry("LDAP://<IP/name>/CN=dummy,DC=corp",
"<admin>",
"<admin pass>"))
{
user.Invoke("SetPassword", new object[] { "password" });
user.CommitChanges();
}
这篇关于创建用户在PDC时出错0x800706BA。有没有人seeen前?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文