N
Nacho
I am trying to make a small python application to change DNS servers
in a small LAN.
I am trying this code but I don't manage it to work, I only get the
values removed.
My code is this:
import win32com.client
objWMIService = win32com.client.GetObject("winmgmts:
{impersonationLevel=impersonate}!\\\\" + strComputer + "\\root\
\cimv2")
nicList = objWMIService.ExecQuery("SELECT * FROM
Win32_NetworkAdapterConfiguration WHERE IPEnabled = True")
for nic in nicList:
nic.DNSServerSearchOrder = (u'1.2.3.4', u'2.3.4.5')
nic.SetDNSServerSearchOrder
nic.SetDNSServerSearchOrder returns 0 so it is supposed to have been
done correctly, but no DNS Server is found in the Network Properties.
I don't know what I am doing wrong so any hint or any documentation
about this would be appreciated.
Thank you by now.
in a small LAN.
I am trying this code but I don't manage it to work, I only get the
values removed.
My code is this:
import win32com.client
objWMIService = win32com.client.GetObject("winmgmts:
{impersonationLevel=impersonate}!\\\\" + strComputer + "\\root\
\cimv2")
nicList = objWMIService.ExecQuery("SELECT * FROM
Win32_NetworkAdapterConfiguration WHERE IPEnabled = True")
for nic in nicList:
nic.DNSServerSearchOrder = (u'1.2.3.4', u'2.3.4.5')
nic.SetDNSServerSearchOrder
nic.SetDNSServerSearchOrder returns 0 so it is supposed to have been
done correctly, but no DNS Server is found in the Network Properties.
I don't know what I am doing wrong so any hint or any documentation
about this would be appreciated.
Thank you by now.