I want find many User, who have locked account in my file.txt

file.txt:

```
Login:                  ID:
User_SameAccountName     1111111112
User_SameAccountName2    1234252566
User_SameAccountName3    13124251255

```

My powershell script:

```
$myarray = Search-ADAccount -LockedOut | select SamAccountName

$i = 1
while($i -le 5){
Select-String -Pattern "$myarray[$i]" -Path E:\file.txt
$i += 1

}

```

I dont have any errors. Script run and looks everything is OK but dont have result

When I do this commands with

```
Get-LocalUser | select name

```

in file.txt are LocalUser name, evrything is fine.

I need connect locked User with ID, but in AD account dont have this value: ID number, so I want search User by Search-ADAccount and take their ID from the file.

**I solved the problem like this**

```
$myarray = Search-ADAccount -LockedOut | select -ExpandProperty SamAccountName

$result = foreach ($i in $myarray){
Select-String -Path "mypath" -pattern $i | select -ExpandProperty Line}
$result | out-file 'mypath2'

```