Discover DNS servers as part of Server Discovery

geethunannapane
Giga Contributor

I want to discover primary and Secondary DNS Servers as part of Server Discovery, I am not sure if OOB discovery finds this information from Server. Any help would be appreciated.

6 REPLIES 6

doug_schulze
ServiceNow Employee
ServiceNow Employee

Doesnt happen out of box but sure!  Just create a new probe/sensor, add it to your Windows Server classifier and away you'll go...

 

Seems you can get that info through WMI or in the Registry.. 

 

https://docs.microsoft.com/en-us/windows/desktop/cimwin32prov/win32-networkadapterconfiguration

Kiran7
Giga Expert

Hi Geethunannapaneni,

We have to create a custom probe and sensor to achieve this as this is not OOB functionality.

1. create a custom field as DNS Server

2.create custom probe:

find_real_file.png

 

3. Create a sensor to process the information:

for e.g-

new DiscoverySensor({
process: function(result) {

var name= this.getCmdbRecord.name;

var output=result.<tag in which the dns name is coming>; // see the payload of the probe and get the tag name

var gr=new GlideRecord("<table name to which you want to set the data>");

gr.addQuery("name",'<name of the CI>'); //

gr.query();


while(gr.next())

    {
      gr.u_dns_server=output;
      gr.update();
     }
},

type: "DiscoverySensor"
});

 

 

Hit helpful/correct on the impact of the answer.

 

Warm Regards,

Kiran Salunkhe

Engineer


www.DxSherpa.com

Hi Kiran,

 

Thanks for that. 

I am able to pull one of the DNS Servers using that command. We have more than one DNS servers.

This command is running on MID Server and not on every server in the network. It is giving the DNS Servers only for the MID Server.