PowerShell: Get AD users detail from Display Name
Clear-Host
$users = [System.Collections.ArrayList]@()
$users = @(Get-Content C:\Temp\Users.txt)
$n = -1
foreach ($user in $users)
{
$n++
$user = $users["$n"]
Get-ADUser -SearchBase "OU=Int,DC=lab,DC=com" -Server DC01.lab.com -Filter "DisplayName -like '$user'" -Properties * | Select-Object -Property DisplayName,Department,SAMAccountName,mail
}