Extension Attributes Question

ts85
New Contributor III

I have a group of computers in a remote office that I need to pull the DNS info from. However, the admin at that location renamed the default interface from "Ethernet" to "LAN." This is due to having also a Metadata interface as well so each is distinguishable.

I wrote the following based off another default DNS Extension Attribute that was pre installed on our JSS.

#!/bin/sh
echo "<result>`/usr/sbin/networksetup -getdnsservers LAN 2>&1`</result>"

This works when testing on one of the machines remotely. However when I make a smart group and apply "DNS resolved IS NOT <new DNS IP>" at Location I still retrieve all the machines including a few I manually changed for testing purposes. When viewing Extension Attributes in a machines inventory I see no data output.

Curious what I'm missing.. any insight or help is greatly appreciated!

1 ACCEPTED SOLUTION

qhle373
Contributor

You could try setting your result as a variable and having echo the variable name. The following is just an example, unsure if it would directly work in your EA. Also EA's update content upon next Inventory Checkin so you may want to take a peak at the rate that you have that occur as well.

#!/bin/sh
test=`/usr/sbin/networksetup -getdnsservers LAN 2>&1`

echo "<result>$test</result>"

View solution in original post

1 REPLY 1

qhle373
Contributor

You could try setting your result as a variable and having echo the variable name. The following is just an example, unsure if it would directly work in your EA. Also EA's update content upon next Inventory Checkin so you may want to take a peak at the rate that you have that occur as well.

#!/bin/sh
test=`/usr/sbin/networksetup -getdnsservers LAN 2>&1`

echo "<result>$test</result>"