Network Settings Reset Tool

xacked

New Member
Reaction score
0
This is a network fix batch file that I created for work, feel free to modify it to suit your needs. Note that it assumes your router/modem is going to DHCP and provide an IP, if your customer is hardcoded then you might want to cut out the netsh commands that will wipe it.

Cheers,
Jonathan

EDIT: newest version attached, see post below with a description of the changes
 

Attachments

Last edited:
Last I checked...

echo Removing hardcoded IPs...
netsh interface ip set address "Local Area Connection" dhcp
netsh interface ip set address "Wireless Network Connection" dhcp
netsh interface ip set dns "Local Area Connection" dhcp
netsh interface ip set dns "Wireless Network Connection" dhcp

...shouldn't be needed since...

netsh interface ip reset

...clears out any static ip settings.
 
Last I checked...



...shouldn't be needed since...



...clears out any static ip settings.

That's what I thought initially in my research but when I tested setting up fake hardcoded IPs then simply running "netsh interface ip reset" all it did was clear out the hardcoded IPs, it didn't switch it back to DHCP, and the DNS servers stayed static...

Give it a try too, I'd like someone else to verify my results :o
 
I'm a Desktop Support Tech in corp as well...This is very handy tool..
Thank you

...I'm a total newbie with bat files or scripting so thanks for this.
 
Here's my adapted version; it first checks the connection to see if it's active (credit to Methical's scripts), and removes proxy settings, sets some necessary services to autostart, attempts to disable the hosts file and resets the windows firewall settings.
View attachment internetfix.zip

I also made a version that should leave IP settings intact (for business networks, formally networked customers, etc)
View attachment internetfixfixedip.zip

These versions should also backup network settings before proceeding with the repair. This batch file should allow you to restore the backup:
View attachment InternetSettingsRestore.zip

Any testers would be greatly appreciated
 
Last edited:
Oo presents! Will check these out when I can, probably next week once ill staff get back.
 
Thanks for sharing! Appreciated! Will check it out tomorrow. Will ad to your rep as well ofcourse. Iisjman, thank you as well!! Will test soon.

I'm not much of a scripter myself yet. I'd like to learn the basics though. First have to find me some time :P

Cheers!

Sent from my Desire HD using Tapatalk
 
I'm a Desktop Support Tech in corp as well...This is very handy tool..
Thank you
...I'm a total newbie with bat files or scripting so thanks for this.

Though I am not familiar with the specifics of the coding, this is an awesome idea and can be very useful. Thank you for sharing it with the community, I added to you rep!

Here's my adapted version; it first checks the connection to see if it's active (credit to Methical's scripts), and removes proxy settings, sets some necessary services to autostart, attempts to disable the hosts file and resets the windows firewall settings.
View attachment 1212

I also made a version that should leave IP settings intact (for business networks, formally networked customers, etc)
View attachment 1211

These versions should also backup network settings before proceeding with the repair. This batch file should allow you to restore the backup:
View attachment 1213

Any testers would be greatly appreciated

Thanks for sharing! Appreciated! Will check it out tomorrow. Will ad to your rep as well ofcourse. Iisjman, thank you as well!! Will test soon.

I'm not much of a scripter myself yet. I'd like to learn the basics though. First have to find me some time :P

Cheers!

Sent from my Desire HD using Tapatalk

@iisjman07: Thanks for the add!

@everyone:
I've updated the script to include what iisjman07's batch files added and some more...
  • Integrated the two so it will prompt the user on whether or not they would like to remove hardcoded IPs (along with a short note of what to do if the tech isn't sure..maybe in the future this can generate a txt file of the hardcoded IPs if they are needed?).
  • Also added a manual override for the scenario where ping works but there is still a connectivity issue and the fix is still needed.
  • Added pretty background colors, blue to show the script is running its fixes, red to show an error, and green at the end when the process is completed.
  • Added a creative commons licence to raise awareness of a great alternative to copyright, it's unrestrictive and only asks for users who modify it to give credit where credit is due ;)

I'm glad you guys are all finding this helpful! The rep adds are much appreciated, hope you guys are having a good holiday season. :)
 

Attachments

Last edited:
This topic should really be moving to the 'Automation & Scripting' thread.
I thought I would chime in here, cos after reading the very first post from the OP, my skin just started to crawl .. 'Assumption' has no part in automation :)

Maybe this lil' snippet might help you out. I used it as part of my DNS-Switcher.
It detects wether or not the computer has DHCP enabled or not.
Code:
:dnsswitcher
ipconfig /all ^| Find /i "DHCP Enabled" > DHCP_Enabled.txt
find /c "Yes" "DHCP_Enabled.txt" > nul
if "%errorlevel%"=="0" goto dhcpdisabled
if "%errorlevel%"=="1" goto dhcpenabled
:dhcpdisabled
call "Batch\DNSSwitcher.bat"
@ping 127.0.0.1 -n 3 -w 1000 > nul 
echo.
echo Returning to Network Tools Menu..
@ping 127.0.0.1 -n 3 -w 1000 > nul 
goto networkmenu	
:dhcpenabled
echo.
echo DHCP is enabled.
echo.
echo To change your DNS Server configuration, please manually login to the router.
echo The following DNS entries are alternate to that your ISP provides.
echo.
echo                Primary DNS        Secondary DNS
echo  OpenDNS    :  208.67.220.220  :  208.67.222.222
echo  GoogleDNS  :  8.8.8.8         :  8.8.4.4
echo  ComodoDNS  :  156.154.70.22   :  156.154.71.22
echo  UltraDNS   :  156.154.70.1    :  156.154.71.1 
echo.
@ping 127.0.0.1 -n 10 -w 30 > nul
echo Returning to Network Tools Menu..
@ping 127.0.0.1 -n 5 -w 1000 > nul 
goto networkmenu

If you would like the DNSSwitcher.bat file, I could send it to you do add into the script. It is menu-oriented, but also takes paramters from the command line.
 
Last edited:
Back
Top