locked
dnsserver module RRS feed

  • Question

  • when i query with module dnsserver
    get-dnsserverresourcerecord -computername cbsdcs201 bloodservices.ca
    i get to display ip address
    xenapps                   A          1          0                    01:00:00        10.100.0.25
    xenappsig                 A          1          0                    01:00:00        192.75.184.65
    xirrus-xms                A          1          0                    01:00:00        140.18.101.224
    zeb1                      A          1          0                    01:00:00        140.18.97.188

    when i specify certain attributes
    get-dnsserverresourcerecord -computername cbsdcs201 bloodservices.ca | select HostName, RecordType, RecordData

    xenapps                                            A          DnsServerResourceRecordA
    xenappsig                                          A          DnsServerResourceRecordA
    xirrus-xms                                         A          DnsServerResourceRecordA
    zeb1                                               A          DnsServerResourceRecordA

    i dont see the ip address

    my objective is to export to txt or csv file HostName, RecordType, ipaddress

    if i run the code without attributes and export to csv - i get the following

    HostName RecordClass RecordData RecordType
    @ IN DnsServerResourceRecordA A
    @ IN DnsServerResourceRecordA A
    @ IN DnsServerResourceRecordA A
    @ IN DnsServerResourceRecordA A

    i dont understand why it is not displaying properly

    Friday, March 23, 2018 2:54 PM

Answers

  • Get-DnsServerResourceRecord -ZoneName ZONENAME -ComputerName HOSTNAME| Select-Object -Property hostname,recordtype,@{name="IP Address";EXPRESSION = {$_.recorddata.ipv4address}} | Format-Table -AutoSize

    You should be able to work off the above example. Let us know if you need any further help.

    Learn PowerShell                     Script Requests

    -Remember to mark the correct response as the answer-

    • Proposed as answer by jrv Friday, March 23, 2018 7:24 PM
    • Marked as answer by Christopher Ellis Friday, March 23, 2018 10:56 PM
    Friday, March 23, 2018 3:40 PM

All replies

  • Get-DnsServerResourceRecord -ZoneName ZONENAME -ComputerName HOSTNAME| Select-Object -Property hostname,recordtype,@{name="IP Address";EXPRESSION = {$_.recorddata.ipv4address}} | Format-Table -AutoSize

    You should be able to work off the above example. Let us know if you need any further help.

    Learn PowerShell                     Script Requests

    -Remember to mark the correct response as the answer-

    • Proposed as answer by jrv Friday, March 23, 2018 7:24 PM
    • Marked as answer by Christopher Ellis Friday, March 23, 2018 10:56 PM
    Friday, March 23, 2018 3:40 PM
  • Format-Data converts everything to text, If any one want to Export it as Csv or convert an Object to another type of object, no Formatting cmdlets should be used.

    Get-DnsServerResourceRecord -ZoneName ZONENAME -ComputerName HOSTNAME| Select-Object -Property hostname,recordtype,@{name="IP Address";EXPRESSION = {$_.recorddata.ipv4address}} | Export-Csv -Path C:\CsvPath.csv -NoTypeInformation


    Regards kvprasoon

    • Proposed as answer by jrv Friday, March 23, 2018 7:24 PM
    Friday, March 23, 2018 6:51 PM