Is there any powershell command that outputs the users that have their passwords expired from a specific organizational unit (OU).
If so can it be combined in a script with another command that outputs the time when it expires for all the users in the specific OU ?
Thank you.
Get AD Users Password Expiration Report from Specific OU:
You may also take help from this blog which lets you how to email users a active directory password expiration notification and schedule reports, alerts and be compliant with all password expiration related tasks to save your time: http://www.symantec.com/connect/blogs/how-automate-password-change-notification-through-email
Users with expired passwords:
To get time when password expires you should get PasswordLastSet property and add MaxPasswordAge from domain policy (e.g. $DefaultmaxPasswordAge = (Get-ADDefaultDomainPasswordPolicy).MaxPasswordAge).
Please have a look at Password Expiry Email Notification script on TechNet: https://gallery.technet.microsoft.com/Password-Expiry-Email-177c3e27 Good sample for the subject.
To list enabled users with expired passwords in a specific OU:
To list enabled users within a specific OU with password expiration dates: