Maybe this helps:
$file = Get-Content -Path "C:\Temp\UsersLastLogon.txt"
foreach ($user in $file)
{
Get-ADUser -Identity $user -Properties LastLogonDate | Select-Object SamAccountName, LastLogonDate
}
(If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)
Regards
Andreas Baumgarten