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