Get-WmiObject to get Specific DNS records

Hi all,

I’m trying to get a list of static DNS A Records. I’ve tried doing a double filter, adding a Where-object statement at the end of this line, but everything errors out on me. I also thought about putting the results of this into a variable, and then running an IF statement, but that didn’t work either. Get-dnsserverresourcerecord only returns the hostname, and I need the FQDN that this line returns. Does anyone know what I should add to the following line to get this to work? $zonename is variable that’s working fine. If the one line can’t do what I’m looking for, can you point me in the right direction? TIA

Get-WmiObject -Class MicrosoftDNS_AType -NameSpace Root\MicrosoftDNS -ComputerName  -Filter "DomainName = '$zonename'" | Select-Object -property Ownername, IPAddress, Timestamp

I think I’m possibly not following what it is you want, which this does not do…?

That line works, but returns the non-static records too. I need a way of only getting the static records.

Ah - someone in another forum got it, so the correct answer for those wondering is:

Get-WmiObject -Class MicrosoftDNS_AType -NameSpace Root\MicrosoftDNS -ComputerName -Filter "DomainName = '$zonename' AND TimeStamp = 0" | Select-Object -property Ownername, IPAddress, Timestamp


Its easier if you use the cmdlets from the DNSserver module

Get-DnsServerResourceRecord -ComputerName W16DC01 -ZoneName ‘’ -RRType A |
where {-not $_.TimeStamp}

Also I’d recommend using Get-CimInstance rather than Get-WmiObject