$server = Get-ADComputer -SearchBase "a OU in a domain*" -Filter {Name -like "*79234*"} | Select -Property *
This work it pulls the computer object like I want. A computer object with those numbers in the name.
In previous code I define a
$array[$where] = 79234
$server = Get-ADComputer -SearchBase "a OU in a domain*" -Filter {Name -like "*$($array[$where])*"} | Select -Property *
Fails and does not give me my match. Why?
"$($array[$where])" = 79234 in the commandline..
I did use work around it by create the object name I'd searching for before I search
$FilterName = "*$($Array[$Where])*"
$server = Get-ADComputer -SearchBase "a OU in a domain*" -Filter {Name -like $filterObjectname} | Select -Property *
Gives me the correct object, I think the root issue is they way the values are past between the objects (casting?) but I'm missing it.