Get-DnsServerResourceRecord filter records

Welcome Forums General PowerShell Q&A Get-DnsServerResourceRecord filter records

This topic contains 1 reply, has 2 voices, and was last updated by

1 year, 3 months ago.

  • Author
  • #82544

    Points: 0
    Rank: Member

    Hi guys,

    Today I was trying to search DNS records filtered by CSV file in which I had computername and IP address.

    So the command was:
    $dns=import-csv dns.csv

    Get-DnsServerResourceRecord -ZoneName -ComputerName . -Name $dns[0].ComputerName | ? {$_.recorddata.ipv4address -like $dns[0].IP} – which gave me no results, but when i hardcoded ip address i got the results, for example :

    Get-DnsServerResourceRecord -ZoneName -ComputerName . -Name $dns[0].ComputerName | ? {$_.recorddata.ipv4address -like ""}

    Could you figure out where is the problem? I guess is in types of properties as the recorddata.ipv4address is ciminstance type while $dns[0].ip is string type.

    Many thanks!

  • #82555

    Points: 1
    Rank: Member

    yeah it could be the type mismatch. You should be able to add .ToString() on the end of $_.recorddata.ipv4address, that should then have you comparing two strings.

The topic ‘Get-DnsServerResourceRecord filter records’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort