I have a list of user names ex. last name, First name. Here is my script
foreach ($user in (Get-Content -Path U:\Morningstar\Morningstar.txt))
{Get-ADUser -filter { DisplayName -like “$user” }} | samaccountname
The problem is the -filter part.
I have a list of user names ex. last name, First name. Here is my script
foreach ($user in (Get-Content -Path U:\Morningstar\Morningstar.txt))
{Get-ADUser -filter { DisplayName -like “$user” }} | samaccountname
The problem is the -filter part.
it’s working now:
Here is the script:
foreach ($user in (Get-Content -Path U:\Morningstar\Morningstar.txt))
{Get-ADUser -filter { DisplayName -like $user } | Select SamAccountName }