Check Active Directory From File

$names = Get-content "C:\list.txt"
$file = '\\share\inad.txt'
while ((Test-Path $file))
{
$file = $file.Replace(".txt", "_.txt")
}
foreach ($name in $names)
{
$Addresses = $null
try {
get-adcomputer $name -erroraction Stop
$Result = $true
"$name" >> $file
}
catch{
$Result = $false
}
[PSCustomObject]@{
Name =$name
Found = $Result
}
}