Two, three command lines today to search, and list users with a password that never expires, within an Active Directory. As a reminder this practice is not recommended at all, especially for accounts with strong privileges. You can copy and paste the code below, it will generate a .csv file in the directory c:\temp\
#Importe the ActiveDirectory module
#Recherche users with a password set to "never expire"
get-aduser -filter -properties Name, PasswordNeverExpires where
$.passwordNeverExpires -eq "true" Select-Object DistinguishedName,Name,Enabled
Export-csv v: Temp-PasswordNeverExpire.csv -NoTypeInformation