def get_dns_servers(interface='Local Area Connection'):
 interface = interface.split('\\')
 interface = ''.join(interface)
 with salt.utils.winapi.Com():
  c = wmi.WMI()
  for iface in c.Win32_NetworkAdapter(NetEnabled=True):
   if (interface == iface.NetConnectionID):
    iface_config = c.Win32_NetworkAdapterConfiguration(Index=iface.Index).pop()
    try:
     return list(iface_config.DNSServerSearchOrder)
    except TypeError:
     return []
 log.debug('Interface "{0}" not found'.format(interface))
 return False

def get_dns_servers ( interface = 'Local Area Connection' ) : interface = interface . split ( '\\' ) interface = '' . join ( interface ) with salt . utils . winapi . Com ( ) : c = wmi . WMI ( ) for iface in c . Win32_NetworkAdapter ( NetEnabled = True ) : if ( interface == iface . NetConnectionID ) : iface_config = c . Win32_NetworkAdapterConfiguration ( Index = iface . Index ) . pop ( ) try : return list ( iface_config . DNSServerSearchOrder ) except TypeError : return [ ] log . debug ( 'Interface "{0}" not found' . format ( interface ) ) return False
return a list of the configured dns servers of the specified interface cli example: .