Get Computer Name by Description

Hi,
I try get computer name by description
but it not working correct
it get just last name from my list
This my code:

$username = Get-Content “C:\Users.txt”

foreach ($entry in $username)
{
Get-ADComputer -Filter (“Description -Like ‘$entry’”) -Property Name,Description |
Select Name,Description |
Export-Csv “C:\CompName.csv” -NoTypeInformation
}

You’re calling Export-Csv inside a loop without the -Append switch, which will just keep overwriting the file. One alternative is to turn this into a single pipeline with Export-Csv at the end (so it’s only called once, but receives multiple input objects):

Get-Content "C:\Users.txt" |
Get-ADComputer -Filter ("Description -Like '$_'") -Property Name,Description |
Select Name,Description |
Export-Csv "C:\CompName.csv" -NoTypeInformation

Hi Dave,

Thank you for replay, the -Append work

Thanks.