I am looking to query AD via Powershell in order to see all user accounts within my forest who have their password set to never expire.
I found a few scripts online using a quick google search but none of them appear to work as expected. I then found the following on technet (https://technet.microsoft.com/en-us/library/finding_users_whose_password_never_expires%28v=ws.10%29.aspx) however when I run the line:
Search-ADAccount -PasswordNeverExpires | FT Name,ObjectClass -A
I only receive a very small number of results and I know that the list returned is missing a large number of users who I know have this option set.
Please can someone tell me what is incorrect with this script or what the reason for the small result set could be?
Get-ADUser -filter * -Properties PasswordNeverExpires | select name,Pass wordNeverExpires | Where-Object {$_.PasswordNeverExpires -like "True"}
does that give you the same results as search-adaccount?