-
Notifications
You must be signed in to change notification settings - Fork 47
/
DNS Servers.xml
37 lines (37 loc) · 2.04 KB
/
DNS Servers.xml
1
<?xml version="1.0" encoding="UTF-8"?><extensionAttribute> <displayName>DNS Servers</displayName> <displayInCategory>Networking</displayInCategory> <description>This attribute lists all DNS servers set on the active network connection. This attribute applies to both Mac and Windows.</description> <dataType>string</dataType> <scriptContentsMac>#!/bin/shOS=`/usr/bin/sw_vers -productVersion | /usr/bin/colrm 5`if [[ "$OS" < "10.5" ]]; thenif [ -f /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Support/networksetup ];then NetworkInterface=`/System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Support/networksetup -listnetworkserviceorder 2>&1 | grep $(/usr/sbin/netstat -rn 2>&1 | /usr/bin/grep -m 1 'default' | /usr/bin/awk '{ print $6 }') | sed -e "s/.*Port: //g" -e "s/,.*//g"` echo "<result>`/System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Support/networksetup -getdnsservers "$NetworkInterface" 2>&1`</result>"else echo "<result>The networksetup binary is not present on this machine.</result>"fielseNetworkInterface=`/usr/sbin/networksetup -listnetworkserviceorder 2>&1 | grep $(/usr/sbin/netstat -rn 2>&1 | /usr/bin/grep -m 1 'default' | /usr/bin/awk '{ print $6 }') | sed -e "s/.*Port: //g" -e "s/,.*//g"`echo "<result>`/usr/sbin/networksetup -getdnsservers "$NetworkInterface" 2>&1`</result>"fi </scriptContentsMac> <scriptTypeWindows>VBScript</scriptTypeWindows> <scriptContentsWindows> On Error Resume NextstrComputer = "." Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2") Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration",,48) For Each objItem in colItemsIf objitem.ipenabled = True then If isNull(objItem.DNSServerSearchOrder) Then Else strDNS = Join(objItem.DNSServerSearchOrder, "<br>") End IfEnd IfNextWScript.Echo "<result>" & strDNS & "</result>"</scriptContentsWindows></extensionAttribute>