$maxPasswordAge = (get-addefaultdomainpasswordpolicy).MaxPasswordAge.Days
Get-ADUser -Filter * -Properties CannotChangePassword,PasswordNeverExpires,LastLogonDate,Passwordexpired,passwordlastset | Select Name, SamAccountName ,CannotChangePassword, PasswordNeverExpires, Enabled, LastLogonDate, Passwordexpired, Passwordlastset,@{l="ExpiryDate";e={$_.PasswordLastSet.AddDays($maxPasswordAge)}} | sort -property name | export-csv users_export.csv -Encoding UTF8
/Geecoholic
No comments:
Post a Comment