Thursday, November 15, 2018

Get Active Directory User's password expiration date.


Most corporation that uses Microsoft's Active Directory has set some password policies for tighter security.  One of them is probably 'Password Expiration' to force users to change their passwords every x amount of days.  I was in a situation where I needed to find a user account password expiration and the first thing that come to my mind is to use Powershell.  Upon Googling on how to do it with Powershell, I found that it is very cumbersome to do it.  You run a get-aduser command and it will output the accountexpires attribute but its not in datetime format.  You'd have to convert it, which didn't work for me.  Then I find that you can use the basic net user command like below.

c:\net user <username> /domain

That's all.


No comments:

Post a Comment

Thank you for your comment.