$users=Get-Content"C:\Temp\D2.txt"
foreach ($userin$users) {
$sam=Get-ADUser-ldapfilter"(displayname=$user)"-Property samaccountname | Select-Object-Property samaccountname
$sam
}
the above code works perfect. It reads the file D2.txt which has 1,514 names inside. In this format: LName, FName. The issue I now have is my code above returns 1,475 samAccountNames with no errors. How do I pipe to a file all of the accounts it could not find or that were bad?