(转)http://msdn.microsoft.com/library/default.asp?url=/library/en-us/adsi/adsi/iadsuser.asp

To bind to a domain user through a WinNT provider, use the domain name as part of the ADsPath, as shown in the following code example.

GetObject("WinNT://MYDOMAIN/jeffsmith,user")

Similarly, use the computer name as part of the ADsPath to bind to a local user.

GetObject("WinNT://MYCOMPUTER/jeffsmith,user")

In Active Directory, domain users reside in the directory. The following code example shows how to bind to a domain user through an LDAP provider.

GetObject("LDAP://CN=Jeff Smith,OU=Sales,DC=Fabrikam,DC=Com")

However, local accounts reside in the local SAM database and the LDAP provider does not communicate with the local database. Thus, to bind to a local user, you must go through a WinNT provider as described in the second code example.

example:
//绑定域,修改用户密码.
DirecotryEntry entry = new DirectoryEntry(“WinNT://DEVTEST/Josson“,“Josson“,“pass“);
//LDAP绑定
//new DirectoryEntry(“LDAP://DEVTEST/CN=jin,CN=Users,DC=devtest,DC=com“,“Josson“,“pass“);

entry.Invork(“ChangePassword“,new object[]{oldPassword,newPassword});

相关文章:

  • 2021-08-09
  • 2021-09-04
  • 2022-02-12
  • 2022-12-23
  • 2021-12-02
  • 2021-10-13
猜你喜欢
  • 2021-08-06
  • 2021-12-02
  • 2021-12-05
  • 2022-01-07
  • 2021-12-31
  • 2021-04-19
相关资源
相似解决方案