The script below lists some user details, it works only in case I've entered the EXACT user name. Is there a method I could use to get results if I type a partial username? I mean if for example I enter "elibukin" or "eli.buk" instaed of "eli.bukin" witch is the correct username.
do {
Write-Host "Who r we looking for ? (type EXIT when u done)"
$User = Read-Host
Get-ADUser $User -Properties * |
fl empl*,title, sam*, disp*, mail*, manager*, depa*, giv*, l, last*,
logon*, when*
} until ($user -eq "exit")
I have actually worked on a script much like this. I used the -like operator to accommodate partial matches. However, this might give you more than one result.
Or use something of this format to narrow down your result:
Use
-or
instead of-and
for a broader result.I would use -LDAPFilter with ambiguous name resolution (ANR).
See https://support.microsoft.com/en-us/kb/243299 for more information about ANR.
If you want fuzzy matching use the parameter
-Filter
with the-like
operator: