def set_static_dns(iface, *addrs):
 addr_index = 1
 for addr in addrs:
  if (addr_index == 1):
   cmd = ['netsh', 'int', 'ip', 'set', 'dns', iface, 'static', addrs[0], 'primary']
   __salt__['cmd.run'](cmd, python_shell=False)
   addr_index = (addr_index + 1)
  else:
   cmd = ['netsh', 'interface', 'ip', 'add', 'dns', 'name={0}'.format(iface), 'addr={0}'.format(addr), 'index={0}'.format(addr_index)]
   __salt__['cmd.run'](cmd, python_shell=False)
   addr_index = (addr_index + 1)
 return {'Interface': iface, 'DNS Server': addrs}

def set_static_dns ( iface , * addrs ) : addr_index = 1 for addr in addrs : if ( addr_index == 1 ) : cmd = [ 'netsh' , 'int' , 'ip' , 'set' , 'dns' , iface , 'static' , addrs [ 0 ] , 'primary' ] __salt__ [ 'cmd.run' ] ( cmd , python_shell = False ) addr_index = ( addr_index + 1 ) else : cmd = [ 'netsh' , 'interface' , 'ip' , 'add' , 'dns' , 'name={0}' . format ( iface ) , 'addr={0}' . format ( addr ) , 'index={0}' . format ( addr_index ) ] __salt__ [ 'cmd.run' ] ( cmd , python_shell = False ) addr_index = ( addr_index + 1 ) return { 'Interface' : iface , 'DNS Server' : addrs }
set static dns configuration on a windows nic cli example: .