IT Scripts Entry

Tags:
Batch Scripts
IT Scripts
ITKE Contests
For privacy, our company name in the script has been changed to "CompanyX"
Script Name: CompanyX Network Adapter Reset Tool
Language: Batch Script for Command Line (Windows)
Purpose: In the event of wireless issues or connectivity problems, I pre-install this script on company laptops in the field so that they can automatically release/renew their IP address, clear ARP tables, test pinging, etc.
Notes: I've converted this Batch (.BAT) script to .EXE so it can be given an icon and is less confusing for our employees.
Script:
@echo off
echo.
title CompanyX Network Adapter Reset Tool
:prompt
color 0C
cls
echo ============================================
echo COMPANYX NETWORK ADAPTER RESET TOOL
echo ============================================
echo Version 1.79
echo ============================
echo.
echo NOTE: The reset command will not work on machines with a static IP.
echo QUESTIONS: Please email support@companyx.com
echo.
echo.
echo ----------
echo MAIN MENU:
echo ----------
echo.
echo Type 'r' to reset network settings, IP log; flush DNS cache and ARP tables
echo Type 'v' to view network adapter settings
echo Type 'pe' to do a ping test of external resources
echo Type 'pi' to do a ping test of internal resources
echo Type 'pia' to do an exhaustive ping test of almost all internal resources
echo Type 'c' to open a command prompt
echo Type 'q' to exit this program
set /p answer=
if ‘%answer%’ == ‘r’ goto reset
if ‘%answer%’ == ‘R’ goto reset
if ‘%answer%’ == ‘v’ goto view
if ‘%answer%’ == ‘V’ goto view
if ‘%answer%’ == ‘Pe’ goto pinge
if ‘%answer%’ == ‘pe’ goto pinge
if ‘%answer%’ == ‘Pi’ goto pingi
if ‘%answer%’ == ‘pi’ goto pingi
if ‘%answer%’ == ‘Pia’ goto pingia
if ‘%answer%’ == ‘pia’ goto pingia
if ‘%answer%’ == ‘C’ goto cmd
if ‘%answer%’ == ‘c’ goto cmd
if ‘%answer%’ == ‘q’ goto quit
if ‘%answer%’ == ‘Q’ goto quit
std::string foo;
:reset
cls
echo RELEASING CURRENT IP ADDRESS... PLEASE WAIT...
ipconfig /release >nul
echo.
echo Current IP Address has been released successfully!
echo.
echo RESETTING IP LOG... PLEASE WAIT...
@netsh int ip reset C:WindowsTEMPIPRESETLOG.txt >nul
echo.
echo IP Log has been reset successfully!
echo.
echo FLUSHING ARP TABLES... PLEASE WAIT...
@netsh interface ip delete arpcache >nul
echo.
echo Address Resolution Protocol Tables have been flushed successfully!
echo.
echo FLUSHING DNS... PLEASE WAIT...
@ipconfig /flushdns >nul
echo.
echo DNS client resolver cache has been flushed successfully!
echo.
echo RENEWING IP... PLEASE WAIT...
@ipconfig /renew >nul
echo.
echo IP Address has been renewed successfully!
echo.
cls
echo POLLING CURRENT STATUS OF IP CONNECTIONS ON THIS COMPUTER... PLEASE WAIT...
ipconfig /all
echo.
echo Reset network settings has completed successfully with no errors.
echo.
echo Please press any key to return to the main menu...
pause >nul
goto prompt
:view
cls
echo PREPARING TO DISPLAY NETWORK ADAPTER SETTINGS... PLEASE WAIT...
echo.
@ipconfig /all
echo.
echo Please press any key to return to the main menu...
pause >nul
goto prompt
:pinge
cls
echo STARTING PING TEST OF EXTERNAL WEBSITES... PLEASE WAIT...
echo.
ping www.google.com
echo.
echo Please press any key to return to the main menu...
pause >nul
goto prompt
:pingi
cls
echo STARTING PING TEST OF INTERNAL RESOURCES... PLEASE WAIT...
echo.
ping internal.companyx.com
echo.
echo Please press any key to return to the main menu...
pause >nul
goto prompt
:pingia
cls
echo STARTING EXHAUSTIVE PING TEST OF INTERNAL RESOURCES... PLEASE WAIT...
echo.
echo If you receive a cascade of errors, you are not connected to the COMPANYX VPN.
echo.
ping internal1.companyx.com
echo.
ping internal2.companyx.com
echo.
ping internal3.companyx.com
echo.
ping internal4.companyx.com
echo.
ping internal5.companyx.com
echo.
ping internal6.companyx.com
echo.
ping internal7.companyx.com
echo.
ping internal8.companyx.com
echo.
ping internal9.companyx.com
echo.
ping internal10.companyx.com
echo.
echo Please press any key to return to the main menu...
pause >nul
goto prompt
:quit
cls
echo.
echo Thank you for using the CompanyX Network Adapter Reset Tool!
echo.
echo.
pause
exit
:cmd
@color 7
cls
cmd
@echo on


Software/Hardware used:
Batch script for Windows (including 7) converted to an EXE
ASKED: October 11, 2011  10:48 PM
UPDATED: April 12, 2012  8:31 AM

Answer Wiki

Thanks. We'll let you know when a new response is added.

Restores the Windows Firewall with Advanced Security policy to the default policy. The current active policy can be optionally exported to a specified file. In a Group Policy object, this command returns all settings to not configured and deletes all connection security and firewall rules… <a href=”http://personalvpnreviews.com/”>VPN Reviews</a> thanks

Discuss This Question: 2  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • makeITfunctional
    [...] Creative: Community newcomer MakeITFunctional made a splash with CompanyX Network Adapter Reset Tool, which we loved since it helped solve a very common problem (we were helping someone tackle the [...]
    0 pointsBadges:
    report
  • Aislecontainment
    Seems interesting and very Helpful Thank you !! Cold Aisle Containment | Hot Aisle Containment
    15 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following