Capture Primary Secondary DNS Server IPs

(imported topic written by thesurg3on91)

How can I capture in two separate columns the primary DNS server IP, and the secondary DNS server IP of my NIC?

(imported comment written by thesurg3on91)

Originally I had this relevance, but I would like separate relevance for each DNS server.

concatenation ", " of

(

addresses of dns servers of it as string

)

of adapters of network

I assumed ‘address of primary dns server of it as string of adapters of network’; but that did not work.

(imported comment written by MrFixit)

You would need to make each DNS server a separate property in your analysisto have them show up in different columns.

One option is make a tuple out of it and choose which item 0 or 1 in the respective retrieved property.

(item 0 of ((preceding text of first “,” of it, following text of first “,” of it) of (concatenation “,” of (addresses of dns servers of adapters of network as string))))

Another is just write it so you are taking the text from either side of the “,”.

(preceding text of first “,” of (concatenation “,” of (addresses of dns servers of adapters of network as string)))

(following text of first “,” of (concatenation “,” of (addresses of dns servers of adapters of network as string)))

Or you can test for a specific value in each property using a whose-it.

if (exists (addresses whose (it = “192.168.1.100”) of dns servers of adapters of network as string)) then (addresses whose (it = “192.168.1.100”) of dns servers of adapters of network as string) else “Missing”

(imported comment written by thesurg3on91)

thank you very much. i played with the option,

(preceding text of first “,” of (concatenation “,” of (addresses of dns servers of adapters of network as string)))

(following text of first “,” of (concatenation “,” of (addresses of dns servers of adapters of network as string)))

which does the job, but only if you have two dns servers. if you have more, then adjusting it did not work.

(preceding text of second"," of (concatenation “,” of (addresses of dns servers of adapters of network as string)))

(following text of second"," of (concatenation “,” of (addresses of dns servers of adapters of network as string)))

(imported comment written by MrFixit)

I’m not very good with regex but you can use something like the following and only select the part you want to report.

The way the example is written it will work with 3 or more DNS servers, but will only report give values for the first 3. Perhaps someone that is good with regex can provide an expression that will repeat 1 to many.

parenthesized parts (1;2;3) of matches (regex "^(

http://0-9.

+);(

http://0-9.

+);(

http://0-9.

+)") of (concatenation “;” of (addresses of dns servers of adapters of network as string))

To just get the second value:

parenthesized part 2 of matches (regex "^(

http://0-9.

+);(

http://0-9.

+);(

http://0-9.

+)") of (concatenation “;” of (addresses of dns servers of adapters of network as string))

You can also throw and exists on the front and use it to test to see if there is a value.

exists parenthesized part 2 of matches (regex "^(

http://0-9.

+);(

http://0-9.

+);(

http://0-9.

+)") of (concatenation “;” of (addresses of dns servers of adapters of network as string))