Tuesday, August 10, 2010

The absolute furthest extent of my 'coding' skillz...

@echo off
:top
cls
echo.
echo.
echo MACLIST MANAGEMENT CONSOLE
echo ==========================
echo.
:choice1
set /p mac=[Enter a 12 character hexadecimal MAC with NO capital letters]?
echo %mac%>>\\lchqcdc01\system32$\MAClist.txt
cls
echo MAC has been added...
echo.
echo 1. Add another MAC
echo 2. Copy maclist and continue
echo.
:choice2
set /P C1=[1,2]?
if "%C1%"=="1" goto top
if "%C1%"=="2" goto copy
goto choice2
:copy
echo Copying newly edited MAClist from LCHQCDC01 to LCHQCDC02...
copy \\lchqcdc01\system32$\MAClist.txt \\lchqcdc02\calloutdll$\MAClist.txt /y
pause
color 0E
goto menu
:menu
cls
echo.
echo Please choose from the following menu
echo =========================================
echo.
echo 1. Stop DHCP service on both corporate DCs
echo.
echo 2. Start DHCP service on both corporate DCs
echo.
echo 3. Query DHCP server status on both corporate DCs
echo.
echo 4. Open Excel spreadsheet and Quit
echo.

:choice3
set /P C=[1,2,3,4]?
if "%C%"=="4" goto quit
if "%C%"=="3" goto query
if "%C%"=="2" goto start
if "%C%"=="1" goto stop
goto choice3

:stop
cls
sc \\lchqcdc02 stop DHCPserver
sc \\lchqcdc01 stop DHCPserver
pause
goto menu

:start
cls
sc \\lchqcdc02 start DHCPserver
sc \\lchqcdc01 start DHCPserver
pause
goto menu

:query
cls
sc \\lchqcdc02 query DHCPserver
sc \\lchqcdc01 query DHCPserver
pause
goto menu

:quit
"G:\Common\Technical Documentation\Network Administration\DHCP\MAC-HOST-USER list.xlsx"
exit
:end


1 comment:

Percussivity said...

I've since added error checking but I won't bore anyone with the latest code.