question

tekbyts avatar image
0 Votes"
tekbyts asked ·

WMI - how to construct a wmi query to find whether a reverse lookup zone is hosted/available in a DNS server?

I have C# code that uses wmi to connect to microsoft DNS servrers to programmatically create/update/delete DNS entries/records. I however am not able to find how to determine or query and tell whether a given reverse lookup zone is hosted in a DNS server or not. Since i am not able to check in advance, I am not able to say why my DNS requests are failing. for example, Is it because the zone is not hosted in the machine i am connecting to? which i can't tell that is the reason the request fails.

dotnet-csharp
· 1
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Your question is more related to C# which our forum doesn't focus on. After discussing with C# support engineer, I will remove DNS tag and add C# related tag.

0 Votes 0 ·

1 Answer

cheong00 avatar image
0 Votes"
cheong00 answered ·

Well, examples on WMI are more often in VB scripts.

To query for RDNS Zones, you can start writing function to query normal DNS zones with this example and removing the giant "Select Case" block to modify the zone.

Now you just need to know RDNS zone names are in format of "3.2.1.in-addr.arpa." for IP block of "1.2.3.0/24", where if the least significant part is "0" it will be omitted, and you're done.

======

Here are also examples for PowerShell if you like, you can see command Get-DnsServerZone return multiple zone names ended with "in-addr.arpa".




·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.