The post is a bit malformed with HTML stuff, but here’s how it should look:
Get-ADComputer -Filter "Name -like '$computername'"
You can sometimes get away with using curly braces and script block syntax (and this is all over the examples), but the -Filter parameter actually expects a string, and this is the most consistent way of getting it to work. In your case, though, the curly brace syntax would probably also work fine:
Get-ADComputer -Filter { Name -like $computername }
It’s mostly when you need to filter based on object properties (such as Name -like $computer.Name ) where the script block example syntax starts to fall apart.