2017-10-25 1 views
1

나는 명령을 실행하면DNS 기록 데이터

$alldns = Get-DnsServerResourceRecord -computername dns-server -ZoneName "domain.com" -RRType "A" 

그것은 완벽하게 보여주는 IP 주소 나오는 :

pc2 A  1   10/24/2017 6:00:0... 00:20:00  192.168.1.149 
Gaming    A   1   10/24/2017 6:00:0... 00:20:00  192.168.1.139 
dc     A   1   0     01:00:00  192.168.1.50 
dc2     A   1   0     01:00:00  192.168.1.51 
Surface    A   1   10/24/2017 8:00:0... 00:20:00  192.168.1.141 
server1      A   1   10/19/2017 7:00:0... 00:20:00  192.168.1.200 

을하지만 추가 명령을 실행하면

$alldns = Get-DnsServerResourceRecord -computername dns-server -ZoneName "domain.com" -RRType "A" | Select-Object -Property Hostname, RecordData, Timestamp 

결과로이 결과가 표시되고 ip가 사라지고 DnsServerResourceRecordA로 바뀝니다. 제발 조언.

pc2  DnsServerResourceRecordA 10/24/2017 6:00:00 PM 
Gaming  DnsServerResourceRecordA 10/24/2017 6:00:00 PM 
dc   DnsServerResourceRecordA 
dc2  DnsServerResourceRecordA 
Surface DnsServerResourceRecordA 10/24/2017 8:00:00 PM 
server1 DnsServerResourceRecordA 10/19/2017 7:00:00 PM 

답변

1

당신은 IPv4Address에 대한 calculated property를 추출하여이 작업을 수행 할 수 있습니다. ExpandProperty를 사용 https://technet.microsoft.com/en-us/library/ff730948.aspx?f=255&MSPPError=-2147217396

아니면

Recorddata 추출 할 수 있습니다 : 선택 객체에서는 다음과 같은 방식으로 calculated property에 대한

Get-DnsServerResourceRecord -computername dns-server -ZoneName "domain.com" -RRType "A" | select-object -Property Hostname,Timestamp, @{Name='RecordData';Expression={$_.RecordData.IPv4Address}} 

자세한 내용을 대신 "RecordData"@{Name='RecordData';Expression={$_.RecordData.IPv4Address}}를 사용할 수 있습니다. 당신은 -ExpandProperty을 당신이 선택한 객체에서 사용해야하고 나머지는 (호스트 이름, 타임 스탬프) -Property을 사용하여 추출 할 수 있습니다. 아래에서를 사용하여 IPv4Address 필드를 얻을 것이다.

Get-DnsServerResourceRecord -computername dns-server -ZoneName "domain.com" -RRType "A" | select-object -ExpandProperty recorddata -Property Hostname,Timestamp 

expandproperty에 대한 : https://blogs.msdn.microsoft.com/vishinde/2012/08/27/expandproperty-in-select-object/

당신이 적절한 IP 주소와 DnsServerResourceRecordA를 대체 할 수있는 어느 쪽이든 .. 설명 @Ara에 대한

+0

감사합니다! 완벽하게 작동합니다. – NobleMan

+0

대체 방법으로 답변 수정. ! – Aravinda