Import-Module ActiveDirectory -EA SilentlyContinue
$u = Get-ADUser -Identity 'zachary.nelson' -Properties DistinguishedName, Department, Title, MemberOf -EA SilentlyContinue
if ($u) {
    Write-Output "DN: $($u.DistinguishedName)"
    Write-Output "Department: $($u.Department)"
    Write-Output "Title: $($u.Title)"
    Write-Output "OU: $($u.DistinguishedName -replace '^CN=[^,]+,','')"
    Write-Output ""
    Write-Output "Groups:"
    $u.MemberOf | ForEach-Object { Write-Output "  $_" }
} else {
    Write-Output "User not found"
}

Write-Output ""
Write-Output "=== All users in OU=Administrative ==="
Get-ADUser -Filter * -SearchBase "OU=Administrative,OU=Departments,DC=cascades,DC=local" -Properties Department,Title -EA SilentlyContinue |
    Select-Object SamAccountName, Name, Department, Title |
    ForEach-Object { Write-Output "  $($_.SamAccountName) — $($_.Name) — $($_.Department) — $($_.Title)" }
