To list all user accounts along with their "never expires" attribute:
dsquery user | dsget user -samid -pwdneverexpires
To list only those with "never expires" in a text file:
dsquery user | dsget user -samid -pwdneverexpires | find "yes" > never-expires.txt
To also filter by active users only type:
dsquery user | dsget user -samid -pwdneverexpires -disabled | find "yes no"
Source: microsoft.public.scripting.vbscript
There's also a "Hey, Scripting Guy" article using VBscript but I couldn't make it work.
There's also a free utility called ADFind but I couldn't make that work either (maybe it was blocked by AV)
See also:
