How can you change Network settings (IP Address, DNS, WINS, Host Name) with code in C#

Posted by rathkopf on Stack Overflow See other posts from Stack Overflow or by rathkopf
Published on 2008-10-16T18:48:37Z Indexed on 2010/03/25 8:53 UTC
Read the original article Hit count: 464

Filed under:
|
|
|

I am developing a wizard for a machine that is to be used as a backup of other machines. When it replaces an existing machine, it needs to set its IP address, DNS, WINS, and host name to match the machine being replaced.

Is there a library in .net (C#) which allows me to do this programatically?

There are multiple NICs, each which need to be set individually.

EDIT

Thannk you TimothyP for your example. It got me moving on the right track and the quick reply was awesome.

Thanks balexandre. Your code is perfect. I was in a rush and had already adapted the example TimothyP linked to, but I would have loved to have had your code sooner.

I've also developed a routine using similar techniques for changing the computer name. I'll post it in the future so subscribe to this questions RSS feed if you want to be informed of the update. I may get it up later today or on Monday after a bit of cleanup.

© Stack Overflow or respective owner

Related posts about networking

Related posts about .NET