ASP.NET - how to change ip,subnet,gateway and both dns in asp.net using vb ?

Asked By Aravind Aravind on 22-Jul-14 11:56 AM
I am try to config ip,subnet,gateway,preferred and secondary dns using netsh for windows server 2008,2012.

Before Netsh cmd support for all os including Win 8,win 8.1.

I need to config form client machine to server machine using netsh cmd lines, I will try in remote login also like i will give server name, username and password with netsh cmd. Below is sample cmd line, using process i will change ip config.

netsh -r Admin-pc -u admin-pc\administrator -p XXXXX interface ip set address name="Local Area Connection" Static 192.168.0.60 255.255.255.0 192.168.0.1

when i run in windows server using cmd prompt it show error like "some commands line not found in specified file"


Dim pip As New Process()
Dim pipa As New ProcessStartInfo("netsh -r Admin-pc -u admin-pc\administrator -p XXXXX interface ip set address name="Local Area Connection" Static 192.168.0.60 255.255.255.0 192.168.0.1")
pip.StartInfo = pipa
pip.StartInfo.UseShellExecute = False
pip.StartInfo.RedirectStandardOutput = True
pip.Start()
pip.WaitForExit()

And if change ip,subnet and default gateway,internet not work, if i change preferred and secondary dns then only internet work and can browse.

I can change ip, subnet, gateway, both dns is some other way,below is the link

http://www.codeproject.com/Questions/795642/How-to-change-IP-Subnet-Gateway-DNS-Prefers-and-al?arn=0

but what problem is if server is logoff,changes not reflect in server machine,may be it logoff.

So i need is if server is logoff, need to change ip,subnet,gateway and both dns using netsh or some other vb codings in asp.net. I am try to change ip address form client machine also.