I’ll omit the bulk of my script and just focus on this piece that is not working. Maybe there is an easier way to accomplish this.
I had to attach my code as this post was not reading it correctly.
Error: Get-ADComputer : Cannot find an object with identity: ‘-filter ‘name -like “someHostName”’’ under: ‘DC=xx,DC=xxx,DC=org’.
However, I can echo $filter, take it’s exact output, append it to get-adcomputer and it works.