I'm at a loss as to why this isn't working, and what to even search for.
I have a simple function Get-FileInput. It simply calls Import-CSV and checks for a specific column before passing on the data.
I have $filterType = "Name"
My test TSV is in the format
db stuff Name
1 2 spare40
Then I have this
$data = Get-FileInput
foreach ($computer in $data)
{
Get-ADComputer -Filter {$filterType -eq "comp1"} | Format-Table
Write-Host "$($computer.$filterType)"
Get-ADComputer -Filter {$filterType -eq "$($computer.$filterType)"} | Format-Table
}
The first Get-ADComputer works fine and outputs a table.
The Write-Host produces the output comp1 in the terminal.
The second Get-ADComputer runs, but does not output anything.