我使用该文中提供的 ADHelper 类操作 AD。
http://www.c-sharpcorner.com/UploadFile/craig_aroa/ADHelper08232005064459AM/ADHelper.aspx1.更改密码功能可以实现。
2.可以对已添加的用户进行“禁用”以及“启用”操作。
3.可以查询已存在的用户信息。但!当我启用新创建的用户时:DirectoryEntry user = ADHelper.CreateNewUser("TestUser");
user.Properties["sAMAccountName"].Value = "TestUser";
user.CommitChanges();
ADHelper.EnableUserAccount("TestUser"); // <-- 异常却引发了异常:
Unhandled Exception: System.DirectoryServices.DirectoryServicesCOMException (0x8
0072035): 该服务器不愿意处理该请求。 (Exception from HRESULT: 0x80072035)我已按照下面的所提供的方法进行了相关的操作,但还是不行。
http://topic.csdn.net/t/20051025/17/4349658.html