M
martybruce
I have some VB.net code.
Basically when the user logs into the app. It checks to see if the
user's AD account password has expired. If so, It will prompt the
user to change it.
mydn = GetDN(txtUsername.Text)
Dim adsPath As String = "LDAP://" & mydn
objUser = New DirectoryEntry(adsPath, txtUsername.Text,
txtOld.Text)
objUser.Invoke("ChangePassword", New Object()
{Trim(txtOld.Text),Trim(txtNew.Text)})
objUser.CommitChanges()
This will change the users password.... if the account password is not
expired. Basically it can't log into AD to change the password
because of the expiration. I could use an admin accout to change. But
I want to use this to verify the users old password for security.
If I could find away to set the PwdLastSet attribute to a date less
than 90 days ago before I tried to set the password, I would be
golden.
I have tried to set the userAccountControl to a value of &H10000,
which is suppose to set the account never to expire. But that is not
working. I think because the group policy of taking priority over the
local account setting.
I have seen plenty of code to set the PwdLastSet to zero to force the
account to expire. Has anyone been able to translate the 64int back
into a date?
Thanks for your help....
Basically when the user logs into the app. It checks to see if the
user's AD account password has expired. If so, It will prompt the
user to change it.
mydn = GetDN(txtUsername.Text)
Dim adsPath As String = "LDAP://" & mydn
objUser = New DirectoryEntry(adsPath, txtUsername.Text,
txtOld.Text)
objUser.Invoke("ChangePassword", New Object()
{Trim(txtOld.Text),Trim(txtNew.Text)})
objUser.CommitChanges()
This will change the users password.... if the account password is not
expired. Basically it can't log into AD to change the password
because of the expiration. I could use an admin accout to change. But
I want to use this to verify the users old password for security.
If I could find away to set the PwdLastSet attribute to a date less
than 90 days ago before I tried to set the password, I would be
golden.
I have tried to set the userAccountControl to a value of &H10000,
which is suppose to set the account never to expire. But that is not
working. I think because the group policy of taking priority over the
local account setting.
I have seen plenty of code to set the PwdLastSet to zero to force the
account to expire. Has anyone been able to translate the 64int back
into a date?
Thanks for your help....