0

I'm currently developing an Windows application using C#, which needs to set different DNS-Servers, based on the Windows User, who is currently using the PC.

The differrent DNS addresses all block different web pages for the User, depending on a previous selected page.

I only found ways to change the DNS-Server when logged in as an Administrator.

Is there any way to use specific DNS addresses for specific users or at least to give non admin users the right to change the DNS server, so I can do it as action, when the application is started?

Thanks a lot.

Stefan Neacsu
  • 653
  • 3
  • 12

1 Answers1

0

You can't, you need elevation to change network settings like that.

You could create a Windows Service that runs with the appropriate permissions, then let it accept an IPC-call of some sorts (for example by starting an HTTP listener, or let it watch a config file for changes) and then change the DNS through WMI.

CodeCaster
  • 147,647
  • 23
  • 218
  • 272