473,385 Members | 2,044 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Change users password in Active Directory

Hi Group,

I am trying to change a users password in Active Directory. I am
getting an error that reads:

"Configuration information could not be read from the domain
controller, either because the machine is unavailable, or access has
been denied."

I can see the users properties, including their password, from the
watch window. The call to ChangePassword is failing. The user I am
connecting to AD as has the rights to change their own password.
I am specifying the IP Address of the DC to connect to it as I cannot
see it via DNS name from my laptop. Any sugestions/tips greatly
appreciated. TIA.

This is the code I am using (which I copied from another post):

rootDSE = New DirectoryEntry(String.Format("LDAP://{0}/rootDSE",
dcDNS), username, oldPassword)
'rootDSE = New
DirectoryEntry(String.Format("LDAP://{0}/rootDSE", dcDNS), "admin",
"i82much", AuthenticationTypes.Secure Or AuthenticationTypes.Sealing Or
AuthenticationTypes.ServerBind)
rootDN =
DirectCast(rootDSE.Properties("defaultNamingContex t").Value, String)
searchRoot = New
DirectoryEntry(String.Format("LDAP://{0}/{1}", dcDNS, rootDN),
username, oldPassword)
searcher = New DirectorySearcher(searchRoot)
searcher.Filter = String.Format("sAMAccountName={0}",
username)
searcher.SearchScope = SearchScope.Subtree
searcher.CacheResults = False
results = searcher.FindAll()
For Each result In results
userEntry = result.GetDirectoryEntry()
Exit For
Next
If userEntry Is Nothing Then
Throw New InvalidOperationException("User not found in
this domain.")
End If

'userEntry.Invoke("ChangePassword", New Object()
{newPassword})

userEntry.Invoke("ChangePassword", New Object()
{oldPassword, newPassword})
userEntry.CommitChanges()

Jul 21 '05 #1
0 1415

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Jet Leung | last post by:
Hi all, How can I modify users in Active Directory ? Actually , I want to change the Active Directory user password . But how can I do that?
3
by: Ching Liang | last post by:
In my web application, I need to authenticate users to the AD and allow users to change the password. From my readings, I find out that I have to use DirectoryEntry class to authenticate the users...
2
by: Rod | last post by:
I have a requirement in which I need to allow the user to log into our ASP.NET application, but also be able to change their Windows password, if it is expired. I had thought that Windows...
3
by: Luis Esteban Valencia | last post by:
Hello gusys, Is it possible to make my asp.net application add users to the AD , I also want to be able to delete users, modify their information, everything through a website. Thanks for the...
1
by: tangus via DotNetMonster.com | last post by:
Hello all, I'm really struggling with getting some Active Directory code to work in ASP.NET. Can you please provide assistance? I am executing the following code: Dim enTry As DirectoryEntry =...
0
by: Rick | last post by:
Hi Group, I am trying to change a users password in Active Directory. I am getting an error that reads: "Configuration information could not be read from the domain controller, either because...
3
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!
3
by: Luc | last post by:
Hi everyone, I had this strange problem. We are using web services for our entreprise applications. We are using IIS as the host for our webservices and IIS is configured to use integrated...
3
by: =?Utf-8?B?QXhlbCBEYWhtZW4=?= | last post by:
Hi, we've got a strange problem here: We've created an ASP.NET 2.0 web application using Membership.ValidateUser() to manually authenticate users with our website. The problem is: If the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...

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.