Import-Module ActiveDirectory

function FileTime2Date($time) {

return ([datetime]::FromFileTime($time)).DateTime

}

$today = Get-Date

$userlist = Get-Content “C:\temp\GetExpiredUsersfromList.txt”

Get-ADUser -Filter * -Properties * |

select sAMAccountName, accountExpirationDate, @{n=’passwordExpiry’;

e={FileTime2Date $_.’msDS-UserPasswordExpiryTimeComputed’}} |

? { $userlist -contains $_.sAMAccountName -and (

$_.accountExpirationDate -le $today -or

$_.passwordExpiry -le $today

)

}