Try
PasswordLastSet
instead of
PwdLastSet
.
As far as I can see, there isn't a
PwdAge
property; you'll need to calculate it from the
PasswordLastSet
property.
Something like this should work:
Search-ADAccount -AccountInactive -TimeSpan 90 -UsersOnly -SearchBase "OU=User Accounts,DC=domain,DC=com" |
Get-ADUser -properties PasswordLastSet, PasswordNeverExpires, PasswordExpired, LastLogonDate |
Where-Object {($_.Enabled -eq $true) -and ($_.PasswordNeverExpires -eq $False)} |
Select-object Name, SamAccountName, PasswordExpired, LastLogonDate, @{ Name = 'PasswordAge'; Expression = { (New-Timespan $_.PasswordLastSet).Days }}, PasswordLastSet |
export-csv "c:\data\export.csv"
Active Directory: Get-ADUser Default and Extended Properties[
^]
NB: The
Get-ADUser
call seems to be required to load certain properties.