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

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

问题描述

考虑此代码尝试创建 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 未被用户代码处理:连接到系统的设备无法正常运行

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 20 characters or less.

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

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