(转)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});