PowerShell: Find Active Directory Accounts with “Password Never Expires”.

This Powershell script finds accounts in Active Directory where the password is set to never expire. Also shows the last time the password was set or reset.

# Find all accounts where password is set to never expire
Get-ADUser -filter * -properties passwordlastset, passwordneverexpires | sort-object name | select-object Name, passwordlastset, passwordneverexpires, enabled

# Find only active accounts where password is set to never expire
Get-ADUser -filter 'enabled -eq $true' -properties passwordlastset, passwordneverexpires | sort-object name | select-object Name, passwordlastset, passwordneverexpires

Leave a comment

Your email address will not be published. Required fields are marked *