Users with the Password Never Expires setting
In an Active Directory environment, we use password policies to enforce users to follow complexity standards and other best practices related to passwords. Users should use complex passwords and should update their passwords at regular intervals. This is one of the basic requirements of identity protection. However, if the user account has the Password Never Expires setting enabled, the user will not be forced to update the passwords according to the password policy.
We can find Active Directory user accounts that have the Password Never Expires setting enabled by using the following PowerShell commands:
Get-ADUser -Filter {passwordNeverExpires -eq $true -and Enabled -eq $true } -Properties * | Select samAccountName,GivenName,Surname
In the preceding command, I am looking for the passwordNeverExpires
attribute value and if it's set to true, it means the setting is enabled. At the same time, I also checked if the user...