Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a program on a remote computer that I run and if I change the network by specifying another gateway and dns address in the adapter proprietes the program works as usual, no problem will occur.

However when I do the network switching from command line, as follows:

netsh int ip set address "Local Area Connection" static 169.254.144.10 255.255.255.0 169.254.144.200 1
netsh int ip set dns "Local Area Connection" static 169.254.144.200 primary validate=no

It will make the program hang on windows 8, on windows 7 it will work normally until you try to exit the window, only then it will say that it's not responding.

I tried to dump the configuration and restore it (netsh interface dump and netsh exec dumpfile.dat), but I couldn't test this method as in the dumped file there is no mention of gateway or dns - have no idea why it is not included there as that is essential...

Tested this behaviour on more computers. To me it appears that changing by commands is somehow more timely, as when I run the script with the above commands I can see some online related icons on my taskbar go disconnected and then reconnected. When I do the switch by hand they don't even blink. I suppose the drive mapping gets disconnected for a moment and that's why the program hangs...

So what is the difference between changing the network "by hand" and by the netsh command? How to change it from command to achieve the switch in the same manner?


The program has a text user interface, opened in the command window. It has to be run from a mapped drive as cmd doesnt support UNC paths.

The details when it hangs:

Problem signature:
  Problem Event Name:   InPageError
  Error Status Code:    c000020c
  Faulting Media Type:  00000000
  OS Version:   6.1.7601.2.1.0.256.48
  Locale ID:    1048
  Additional Information 1: 9189
  Additional Information 2: 9189fca27356e4825c153d6761541c45
  Additional Information 3: 5c2b
  Additional Information 4: 5c2b4817a0e33e756d6f79da7728e015

The remote computer is a windows 2008 server but I'm running the program locally.

My dumpfile:

#========================
# Interface configuration
#========================
pushd interface 


popd
# End of interface configuration



# ----------------------------------
# IPHTTPS Configuration
# ----------------------------------
pushd interface httpstunnel

reset


popd
# End of IPHTTPS configuration



# ----------------------------------
# IPv4 Configuration
# ----------------------------------
pushd interface ipv4

reset
set global icmpredirects=enabled
add route prefix=0.0.0.0/0 interface="Local Area Connection" nexthop=169.254.144.200 metric=1 publish=Yes
add address name="VirtualBox Host-Only Network" address=192.168.56.1 mask=255.255.255.0
add address name="VMware Network Adapter VMnet1" address=192.168.6.1 mask=255.255.255.0
add address name="VMware Network Adapter VMnet8" address=192.168.111.1 mask=255.255.255.0
add address name="Local Area Connection" address=169.254.144.155 mask=255.255.255.0


popd
# End of IPv4 configuration



# ----------------------------------
# IPv6 Configuration
# ----------------------------------
pushd interface ipv6

reset
set interface interface="Teredo Tunneling Pseudo-Interface" forwarding=disabled advertise=disabled mtu=1280 metric=0 siteprefixlength=0 nud=disabled routerdiscovery=disabled managedaddress=disabled otherstateful=disabled weakhostsend=disabled weakhostreceive=disabled ignoredefaultroutes=disabled advertisedrouterlifetime=0 advertisedefaultroute=disabled currenthoplimit=0 forcearpndwolpattern=disabled enabledirectedmacwolpattern=disabled


popd
# End of IPv6 configuration



# ----------------------------------
# ISATAP Configuration
# ----------------------------------
pushd interface isatap



popd
# End of ISATAP configuration



# ----------------------------------
# 6to4 Configuration
# ----------------------------------
pushd interface 6to4

reset



popd
# End of 6to4 configuration



# ----------------------------------
# ISATAP Configuration
# ----------------------------------
pushd interface isatap



popd
# End of ISATAP configuration


#========================
# Port Proxy configuration
#========================
pushd interface portproxy

reset


popd

# End of Port Proxy configuration



# ----------------------------------
# TCP Configuration
# ----------------------------------
pushd interface tcp

reset

set global rss=enabled chimney=automatic autotuninglevel=normal congestionprovider=none ecncapability=disabled timestamps=disabled netdma=enabled dca=enabled

Dump has failed when retreiving chimneyapplication  settings.

Dump has failed when retreiving chimneyapplication  settings.

Dump has failed when retreiving chimneyapplication  settings.

Dump has failed when retreiving chimneyapplication  settings.


popd
# End of TCP configuration



# ----------------------------------
# Teredo Configuration
# ----------------------------------
pushd interface teredo
set state type=client servername=teredo.ipv6.microsoft.com. servervirtualip=0.0.0.0



popd
# End of Teredo configuration



# ----------------------------------
# 6to4 Configuration
# ----------------------------------
pushd interface 6to4

reset



popd
# End of 6to4 configuration
share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.