Import-Module ActiveDirectory
foreach ($sam in 'test.caregiver','pilot.test') {
  $u = Get-ADUser -Filter "SamAccountName -eq '$sam'" -Properties mail, MemberOf, Enabled, whenCreated, Description
  if ($u) {
    Write-Output "=== $sam ==="
    Write-Output "DN: $($u.DistinguishedName)"
    Write-Output "UPN: $($u.UserPrincipalName)  mail: $($u.mail)  enabled: $($u.Enabled)  created: $($u.whenCreated)"
    Write-Output "Desc: $($u.Description)"
    Write-Output "Groups: $($u.MemberOf -join '; ')"
  } else { Write-Output "=== $sam : NOT FOUND ===" }
}
$dup = Get-ADUser -Filter "UserPrincipalName -eq 'pilot.test@cascadestucson.com'" | Measure-Object
Write-Output "Users with UPN pilot.test@cascadestucson.com: $($dup.Count)"
