EDN Admin
Well-known member
Hi
I am trying to reset password for the user using following code DirectorySearcher deSearch = new DirectorySearcher();
deSearch.SearchRoot = de;
deSearch.Filter = "(&(objectCategory=user) (cn=" + userID+ "))";
SearchResult result = deSearch.FindOne();
if (result != null)
{
//Create Directory entry object
directoryEntryObject.Invoke("SetPassword", new Object[] {
randomGeneratedPwd});
directoryEntryObjec.Properties["pwdLastSet"].Value = 0;
directoryEntryObjec.CommitChanges();
}
If try to reset password for the same user 5 times in a row, it works for the first 3 times but fails 4th time with exception
The server is unwilling to process the request. Exception from HRESULT: 0x80072035
If I try again after few mins it works.
Why does not it now work consistently?
I checked article Reset AD User Password with C# and ASP.NET
There is a last code statement directoryEntry.Properties["LockOutTime"].Value = 0;
What does this statement do?
Regards,
RK
Radhakrishna
View the full article
I am trying to reset password for the user using following code DirectorySearcher deSearch = new DirectorySearcher();
deSearch.SearchRoot = de;
deSearch.Filter = "(&(objectCategory=user) (cn=" + userID+ "))";
SearchResult result = deSearch.FindOne();
if (result != null)
{
//Create Directory entry object
directoryEntryObject.Invoke("SetPassword", new Object[] {
randomGeneratedPwd});
directoryEntryObjec.Properties["pwdLastSet"].Value = 0;
directoryEntryObjec.CommitChanges();
}
If try to reset password for the same user 5 times in a row, it works for the first 3 times but fails 4th time with exception
The server is unwilling to process the request. Exception from HRESULT: 0x80072035
If I try again after few mins it works.
Why does not it now work consistently?
I checked article Reset AD User Password with C# and ASP.NET
There is a last code statement directoryEntry.Properties["LockOutTime"].Value = 0;
What does this statement do?
Regards,
RK
Radhakrishna
View the full article