ADSI Question 
Author Message
 ADSI Question

Hi,

I have just started working with ADSI and have got all the contection and
properties to work...however one thing i have no idea where to start with is
resetting a users password.

Can this be done?  is it using COM?  any ideas?

many thanks

Arran



Sun, 21 Mar 2004 17:54:57 GMT  
 ADSI Question
You need to Invoke the native methods SetPassword, ChangePassword.

Sample set the password:

   string UserPath = "LDAP://dddd/CN=SomeUserName,CN=Users,DC=....,DC=....,DC=....";
   DirectoryEntry userEntry = new DirectoryEntry(UserPath, strUsername, strPassword, AuthenticationTypes.Secure );
   object[] password = new object[] {"mysecretpwd"};            // New and Old password strings when ChangePassword
   object ret = userEntry.Invoke("SetPassword", password );  // Or ChangePassword
   userEntry.CommitChanges();

Willy.

Quote:

> Hi,

> I have just started working with ADSI and have got all the contection and
> properties to work...however one thing i have no idea where to start with is
> resetting a users password.

> Can this be done?  is it using COM?  any ideas?

> many thanks

> Arran



Sun, 21 Mar 2004 18:03:43 GMT  
 ADSI Question
just what i needed..

thanks


Quote:
> You need to Invoke the native methods SetPassword, ChangePassword.

> Sample set the password:

>    string UserPath =

"LDAP://dddd/CN=SomeUserName,CN=Users,DC=....,DC=....,DC=....";
Quote:
>    DirectoryEntry userEntry = new DirectoryEntry(UserPath, strUsername,

strPassword, AuthenticationTypes.Secure );
Quote:
>    object[] password = new object[] {"mysecretpwd"};            // New and

Old password strings when ChangePassword
Quote:
>    object ret = userEntry.Invoke("SetPassword", password );  // Or

ChangePassword


Sun, 21 Mar 2004 18:28:23 GMT  
 ADSI Question
When i use SetPassword i get a Authentication error....however
changePassword works fine.

But if i want a automatic system with the changepassword i have to know the
original.  Can you get this?  or does it have to be entered by the user?

also where can i see a list of native methods you can invoke on the
DirectoryEntry object?

thanks

Arran


Quote:
> You need to Invoke the native methods SetPassword, ChangePassword.

> Sample set the password:

>    string UserPath =

"LDAP://dddd/CN=SomeUserName,CN=Users,DC=....,DC=....,DC=....";
Quote:
>    DirectoryEntry userEntry = new DirectoryEntry(UserPath, strUsername,

strPassword, AuthenticationTypes.Secure );
Quote:
>    object[] password = new object[] {"mysecretpwd"};            // New and

Old password strings when ChangePassword
Quote:
>    object ret = userEntry.Invoke("SetPassword", password );  // Or
ChangePassword
>    userEntry.CommitChanges();

> Willy.




Quote:
> > Hi,

> > I have just started working with ADSI and have got all the contection
and
> > properties to work...however one thing i have no idea where to start
with is
> > resetting a users password.

> > Can this be done?  is it using COM?  any ideas?

> > many thanks

> > Arran



Sun, 21 Mar 2004 18:51:19 GMT  
 ADSI Question
inline ****
Quote:

> When i use SetPassword i get a Authentication error....however
> changePassword works fine.

> But if i want a automatic system with the changepassword i have to know the
> original.  Can you get this?  or does it have to be entered by the user?

****
This should work, but to set a users password , the binding user needs the 'reset a password' rights.

In the following sample the domain user 'user' should be granted 'reset password' rights.

new DirectoryEntry(UserPath, strUsername, strPassword, AuthenticationTypes.Secure );
****

Quote:
> also where can i see a list of native methods you can invoke on the
> DirectoryEntry object?

****
The DirectoryServices classes are ADSI wrappers, the native methods are the ones implemented by the ADSI provider COM Interfaces.
When  the DirectoryEntry is a User type entry the native interface is IADsUser and the native methods are those implemented by
IADsUser.
So to know the method names you need to lookup the ADSI documentation contained in the platform SDK (MSDN).
****
Quote:
> thanks

> Arran



Mon, 22 Mar 2004 01:17:09 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. ADSI Invoke question...

2. ADSI How to enable user?

3. ADSI:IIS properties, who to enum

4. How to use ADSI methods in C#?

5. Odd ADSI Problem

6. No one to help me? ADSI Problem

7. ADSI

8. ADSI / group policy ?

9. ADSI viewer

10. IIS and ADSI (Trying to add a new Web Site)

11. C# and ADSI

12. microsoft.public.adsi.general

 

 
Powered by phpBB® Forum Software