Password Expiration and Change Password

Occasional Contributor

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 to change the password. This is a .NET Framework 4.8 App delivered via Remote App so the normal windows password expiry warnings do not show nor does the user have access to change their password using <ctrl alt end> or <ctrl alt del>. I need to be able to provide that within my App. I would think that System.Security, or would suffice but I cannot find any information. Everything is about ASP.NET. Please share your solution. Thanks!

3 Replies
Hi Lee,

It can be done with System.DirectoryServices.AccountManagement.UserPrincipal class.

That is what I am using..
Dim adUser As UserPrincipal = UserPrincipal.Current
I 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.