473,566 Members | 3,307 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Changing password using DirectoryEntry

1 New Member
hi there,
I am trying to reset a password using this code snippet and it worked fine but only one concern I have is that, I need to let the user know if he has used a old password wrong. if the user sends a wrong password for resetting I would like to send an exception with error message stating that the old password is not correct. May be some way to allow the user to login to the box with this old password. (is that the correct way). I also need to find whether the machine is up and running. Any help would be greatly helpful to me.
Thanks
John
DirectoryEntry userEntry = new DirectoryEntry( "WinNT://" + machinePath + "/Administrator", adminUserName, oldPassword, AuthenticationT ypes.Secure);
object[] password = new object[] { oldPassword, newPassword };
object ret = userEntry.Invok e("ChangePasswo rd", password);
userEntry.Commi tChanges();
userEntry.Dispo se();
Aug 22 '07 #1
0 1111

Sign in to post your reply or Sign up for a free account.

Similar topics

5
1022
by: Mario Rodriguez | last post by:
Hi people, Does anyone have some idea how to get the password of an active directory user? I tried using the DirectorySearcher object to find the user and the DirectoryEntry.Password property to get the value, but always returns "null" and I'm totally sure that the password is not null thanks
2
5245
by: Frederick | last post by:
Hi, I am using ADAM as my Data Store for my web application and although this seems to be fine when using windows authentication with my local account when I try to create a new user and use this to log on to the adam instance an exception with the following message is thrown "Logon Failure: unknown username or bad password" I set up the...
1
1482
by: Koen | last post by:
Hi, i've written some code that changes the user information (eg givenname, sn, department, ...) from a user in AD. The code runs without an error/exception. The only annoying thing is that the changes aren't executed. here is my code : Dim deEntry As New DirectoryEntry deEntry.Path = "LDAP://myDomainController"
10
9845
by: Fabrizio | last post by:
(Sorry for the crosspost, but I really don't know which is the right newsgroup!) Hi all, I try to change the password to a user that as to change the password at first logon: try {
5
20248
by: Ram | last post by:
Hey, I'v managed to set the "User Must Change Password At Next Logon" flag on the LDAP protocol, Using the - "pwdLastSet" property - by setting it to - "0" (for on) or - "-1" (for off). The problem is, I dont know how to check what's the current status of this user - When I try and read this property from the user's DirectoryEntry, I get a...
1
5879
by: BP | last post by:
Can anyone point me to some C# code/info that would allow me to change the Administrator password on a remote machine in a workgroup? Not a domain, no Active Directory present. I realize I need to know the current password. I've written code to extractall kinds of WMI info from these machines remotely, so am familiar with the need to connect...
0
5188
by: hfleong | last post by:
I am trying to change the Active Directory password using C#. However, it seems to me it does not really works. I wonder what is wrong with my code. Hope somene can help me with this and thanks in advance. Below is my code : try { string dcDNS = "mypsptestdev"; //use this if you want to supply a server name DirectoryEntry userEntry =...
3
4176
by: Xnet | last post by:
I need to change password of a local user of a W2003, without Active Directory. I need to do it from an application created with VB2005. Thanks!
2
5070
by: bemytthm | last post by:
I just want to ask abt communicate with AD using ASP.net. I would want to ask you all to help me correct a problem like this: This is a code i use to change password on AD public bool ChangePasswordAD(string strLogin, string strOldPasswd, string strNewPasswd) { try { string domainAndUsername = "aloha.com" + @"\" +...
0
7673
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7893
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7645
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7953
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6263
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5485
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
1
2085
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1202
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
926
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.