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.

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

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

Sophia Al-Mansoor

Sophia Al-Mansoor

Global Business & E-Commerce Reporter

Sophia analyzes international trade, startup ecosystems, retail transformation, and supply chain logistics for modern digital publications.

Share this article
Twitter Facebook Pinterest