PowerShell DNS query

With my little powershell command i try to get CNAME record from domain.
When i execute this command <Get-DnsServerResourceRecord -ZoneName "ccsmtl.lab" -RRType CName -ComputerName S-ADS001> i have all information. But when it comes to filter to have specific result there is no information for this command <Get-DnsServerResourceRecord -ZoneName "ccsmtl.lab" -RRType CName -ComputerName S-ADS001 | Where {$_.RecordData -like "S-SUBCA001*"}>
In the attached file I put the screenshot of the results of the console powershell
CNameOutPut.txt
Steve BonaInformation Technology SpecialistAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

AlexProject Systems EngineerCommented:
Where {($_.RecordData -like "S-SUBCA001*")}
AlexProject Systems EngineerCommented:
Get-DnsServerResourceRecord -ZoneName "ccsmtl.lab" -RRType CName -ComputerName S-ADS001 | Where {$_.RecordData -like "S-SUBCA001*"} | select-object HostName, RecordType, Type, timestamp,TimeToLive, RecordData   

Open in new window



That's another way, it could be related to the fact you don't have a select-object in there for your output.
Steve BonaInformation Technology SpecialistAuthor Commented:
Get-DnsServerResourceRecord -ZoneName "ccsmtl.lab" -RRType CName -ComputerName S-ADS001 | Where {$_.RecordData -like "S-SUBCA001*"} | select-object HostName, RecordType, Type, timestamp,TimeToLive, RecordData  
It doesn't work ...

If you see in my file this command Get-DnsServerResourceRecord -ZoneName "ccsmtl.lab" -RRType CName -ComputerName S-ADS001 | Where {$_.HostName -eq "pagesblanches"} works fine but i need to filter from RecordData..
oBdACommented:
RecordData is an object itself; try it like this:
Get-DnsServerResourceRecord -ZoneName "ccsmtl.lab" -RRType CName -ComputerName S-ADS001 | Where-Object {$_.RecordData.HostNameAlias -like "S-SUBCA001*"}

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Steve BonaInformation Technology SpecialistAuthor Commented:
It works well, and thanks for the explanation why the previous command did not work before.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Powershell

From novice to tech pro — start learning today.