Forum Discussion
Lee Taylor
Dec 08, 2021Copper Contributor
Password Expiration and Change Password
i think this should be simple to accomplish. I just want my Windows Forms Application running within a domain to be able to check the current user's password expiration and offer them the opportunity...
Krisgolko
Dec 12, 2021Brass Contributor
Hi Lee,
It can be done with System.DirectoryServices.AccountManagement.UserPrincipal class.
Cheers
It can be done with System.DirectoryServices.AccountManagement.UserPrincipal class.
Cheers
- Lee TaylorDec 12, 2021Copper ContributorThat is what I am using..
Dim adUser As UserPrincipal = UserPrincipal.Current
adUser.SetPassword(sPWd)- KrisgolkoDec 12, 2021Brass ContributorI haven't tried to set password with UserPrincipal, but I suspect that non-admin users might only have access to use ChangePassword.
Perhaps, it would be easier to look up the value of AccountExpirationDate property and if it's close to current date, you would prompt a user to change the password in Windows.