I needed to do a quick search in AD for a user this morning. I wrote this script, hope it helps someone.
Clear-Host
Clear-History
$ADFilter = Read-Host -prompt "Search AD "
Get-ADUser -Filter {(Surname -like $ADFilter) -or (GivenName -like $ADFilter)} -Properties *
| Select-Object DisplayName, samAccountName, EmailAddress
| Format-Table -AutoSize
No comments:
Post a Comment