I would like to modify network adapter DNS servers on Windows programmatically. I don't want to use WMI, because it fails for instance when no network cable is connected to the ethernet adapter being modified. What's more, it does not support setting IPv6 configuration.
Therefore I attempted to set DNS servers directly in the system registry:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip[6]\Parameters\Interfaces\[Interface GUID]\NameServer
Unfortunately, these settings are not applied instantly.
Netsh command seems to do what I want perfectly, but honestly, I think it would be better if I could stay away from starting external processes from the application I build. I would like it to be independent. I'm wondering if there is a way to do that. Maybe some other registry changes should be modified as well, or some action should be triggered by WMI?