How to restart my network adapters with a .bat file?

2

I'm an IT student in college and I just started an internship with a local retail company. I do a bit of work on their registers and one thing that we have to do frequently is reset the network adapters on the store machines. Unfortunately, when I do this I lose my connection from logmein and most of the employees aren't exactly computer literate and can't find their way to the network and sharing center if they had a map.

I've tried a few .bat files that have been floating around on the internet. Example:

netsh interface set interface "wireless network adapter" disable

netsh interface set interface "wireless network adapter" enable

wlan connect (ssid)

Unfortunately because this is a retail store and it has over 20 locations the range of software is pretty large. Installing any third party software is a no-go. I need 1 file to run that can quickly reset the adapter. All help is appreciated!

Mackenzie T. Bowen

Posted 2015-09-11T14:10:07.627

Reputation: 79

Did the .bat files that you found not work as you wanted or what was the problem? – Spokey – 2015-09-11T14:25:58.590

I can run the individual commands in the command prompt. I just cant seem to actually make a .bat file that runs with just 1 click. It errors on the first command and says "no more data available" – Mackenzie T. Bowen – 2015-09-11T14:44:39.173

1Remember to run the bat file as Administrator – Anbu – 2015-09-11T14:48:44.020

I ran it as an Administrator but it returns "An interface with that name is not registered with the router" – Mackenzie T. Bowen – 2015-09-11T15:55:51.813

Answers

2

First, you do have to run this in an elevated command prompt (i.e. as administrator).

If you're getting that "An interface with that name is not registered with the router" warning, it means that you haven't selected the correct name for the adapter.

You can run ncpa.cpl to get the list of adapters. Then run the appropriate command, something like:

netsh interface set interface name="Local area connection" admin="disabled"
netsh interface set interface name="Wireless Network Connection" admin="disabled"
netsh interface set interface name="Local area connection" admin="enabled"
netsh interface set interface name="Wireless Network Connection" admin="enabled"

HSuke

Posted 2015-09-11T14:10:07.627

Reputation: 411

D:Thanks! I'll try this first thing when I get to the office in the morning! – Mackenzie T. Bowen – 2015-09-11T22:38:21.060

2Another trick which may come in handy with this is to use the "&" to string multiple commands together: netsh interface set interface name="Local area connection" admin="disabled" & netsh interface set interface name="Local area connection" admin="enabled" . This way you don't have to use batch files, and it will enter the enable command for you even if you've been temporarily disconnected from the remote session. – GuitarPicker – 2015-09-12T07:05:27.693