Finding Active Directory passwords set to never expire

Active Directory Logo V2
Active Directory Logo V2

You can print out the accounts with Password Never Expires definition in your structure with the code I have shared below.

Active Directory passwords set to never expir

When you run the code below with powershell, it exports the list of accounts that you want the password to never expire to C:\Temp\PassNeverExpiresUsers.CSV.

Search-ADAccount -PasswordNeverExpires -UsersOnly -ResultPageSize 2000 -resultSetSize $null | Select-Object Name, SamAccountName, DistinguishedName | Export-CSV “C:\Temp\PassNeverExpiresUsers.CSV” -NoTypeInformation

Active Directory passwords