Can we use canonical name to filter Computers?

I ran a command to get Computers in an OU filtering canonical name rather using searchbase. I got error:

“A filter was used that uses constructed attributes”

What's that?

I think it's because canonicalname is not one of those properties we see by default when we search for computer like Name, DN, etc. It's something you have explicitly mention in properties to get value. That's a wild guess. Image attached for reference.

enter image description here

6

1 Answer

I am not real sure of a use case where one should need to use this property, this way, vs the more commonly use properties, yet, the simple answer is nope.

Of course, there is always...

Clear-Host
Get-ADComputer -Filter '*' -Properties CanonicalName |
Where {$($PSitem.CanonicalName) -eq ' |
Select-Object -Property CanonicalName

Or

(Get-ADComputer -Filter '*' -Properties CanonicalName |
Where {$($PSitem.CanonicalName) -eq ').CanonicalName
2

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like