PC Review


Reply
Thread Tools Rate Thread

change password from .NET program

 
 
Dan Schullman
Guest
Posts: n/a
 
      24th Oct 2003
How can I change a user's password from a .NET program? Is there perhaps a
class for it, or maybe a WMI interface, or some executable I can run? I've
done some MSDN searches but haven't turned up anything so far.

Thanks in advance,
Dan S.


 
Reply With Quote
 
 
 
 
Cowboy \(Gregory A. Beamer\)
Guest
Posts: n/a
 
      24th Oct 2003
If you are talking Windows 2000 or greater, I would look at Active Directory
as a possibility. As I have not done this, I can only guess where you would
best find the info you need.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

**********************************************************************
Think Outside the Box!
**********************************************************************
"Dan Schullman" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> How can I change a user's password from a .NET program? Is there perhaps a
> class for it, or maybe a WMI interface, or some executable I can run? I've
> done some MSDN searches but haven't turned up anything so far.
>
> Thanks in advance,
> Dan S.
>
>



 
Reply With Quote
 
NetPointer
Guest
Posts: n/a
 
      24th Oct 2003
This is how we used to do it in old com days..

Set o = GetObject("WinNT:")
Set usr = o.OpenDSObject("WinNT://" & txtDomain & "/" & txtUserName,
txtUserName, txtOldPassword, 1)
usr.ChangePassword txtOldPassword, txtNewPassword

As indicated it uses Active Directory interface....

Regards.


"Dan Schullman" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> How can I change a user's password from a .NET program? Is there perhaps a
> class for it, or maybe a WMI interface, or some executable I can run? I've
> done some MSDN searches but haven't turned up anything so far.
>
> Thanks in advance,
> Dan S.
>
>



 
Reply With Quote
 
Dan Schullman
Guest
Posts: n/a
 
      25th Oct 2003
Thanks for the pointers. I found and ended up using the .NET DirectoryEntry
class and IADsUser.SetPassword().

--Dan S.


 
Reply With Quote
 
Dan Schullman
Guest
Posts: n/a
 
      25th Oct 2003
By the way, the program takes several seconds to run [on a 2.4 GHz XP Pro
system, with less than 10 users], even when I only query for a few items
(FullName, Description, LastLogin) and do NOT set a password. This doesn't
seem right. Is there something I can do to speed it up?

Here's the J# code:

String adsPath = "WinNT://" + Environment.get_MachineName()
+ "/" + username + ",user";
DirectoryEntry entry = new DirectoryEntry( adsPath );
IADsUser user = (IADsUser) entry.get_NativeObject();
System.out.println( "lastLogin: " + user.get_LastLogin() );
System.out.println( "fullname: " + user.get_FullName() );
System.out.println( "description: " + user.get_Description() );

Thanks,
Dan S.


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Use a substitute Change Password program Jim Microsoft Windows 2000 Deployment 0 1st Nov 2003 07:28 PM
Use a substitute Change Password program Jim Microsoft Windows 2000 Registry 0 1st Nov 2003 07:21 PM
Use a substitute Change Password program Jim Microsoft Windows 2000 Registry Archive 0 1st Nov 2003 07:21 PM
Use a substitute Change Password program Jim Microsoft Windows 2000 Registry Archive 0 1st Nov 2003 07:21 PM
Use a substitute Change Password program Jim Microsoft Windows 2000 Security 0 1st Nov 2003 07:03 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:41 AM.