创建在Active Directory用户:连接到系统的设备无法正常工作 [英] creating a user in Active Directory: A device attached to the system is not functioning

查看:206
本文介绍了创建在Active Directory用户:连接到系统的设备无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

考虑这个code试图创建一个Active Directory帐户。它在这里产生的异常有一定的数据集。目前还不清楚现在是什么导致了异常。

Consider this code attempting to create an Active Directory account. It's generating an exception here with a certain set of data. It's not clear right now what's causing the exception.

 var user = new UserPrincipal(someValidUserContext,
                              ".x-xyz-t-FooFooBarTest", "somePwd", true);

 user.UserPrincipalName = ".x-xyz-t-FooFooBarTest@foobarbatbaz.net";
 user.SamAccountName = ".x-xyz-t-FooFooBarTest";         
 user.DisplayName = "Some String 16 chars long";
 user.Name =  "Some String 16 chars long";
 user.Description = "Foo BarBaz 12 more characters";
 user.AccountExpirationDate = someDateInFuture;
 user.UserCannotChangePassword = true;
 user.Save();

 // exception thrown on Save(): 
 // A device attached to the system is not functioning

PrincipalOperationException是未处理由用户code:   连接到系统的设备无法正常工作

PrincipalOperationException was unhandled by user code: A device attached to the system is not functioning

是什么导致这个例外,你怎么能解决呢?

What's causing this exception, and how can you work around it?

推荐答案

sAMAccountName属性必须少于20个字符。

The sAMAccountName attribute must be less than 20 characters.

这篇关于创建在Active Directory用户:连接到系统的设备无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆