gpt4 book ai didi

c# - 在 Active Directory : A device attached to the system is not functioning 中创建用户

转载 作者:IT王子 更新时间:2023-10-29 04:06:00 28 4
gpt4 key购买 nike

考虑此代码尝试创建一个 Active Directory 帐户。它在这里使用一组特定的数据生成异常。目前尚不清楚是什么导致了异常。

 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

alt text

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

导致此异常的原因是什么,您该如何解决?

最佳答案

sAMAccountName 属性不得超过 20 个字符。

关于c# - 在 Active Directory : A device attached to the system is not functioning 中创建用户,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3095510/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com