System maintenance program for Vista/XP/2000: help needed
Posted: 12 Sep 2008 18:13
This is my first real batch program and it is FUN!! I'm looking at making this a comprehensive program that has MANY features. I'm looking for anyone who wants to help with programming sections (adding additional AV program selections) and system maintenance.
I welcome any and all advice/suggestions/contributions here and would love someone to work on some sections as well.
I've thought of some things to add and wondered if they would be possible:
****Upon connecting to a Wireless LAN or a LAN, automatically run a script that will automatically map drives associated with that network. THIS WOULD BE AWESOME!!!!! 2nd highest priority!
*** Automatically enable/change proxy settings in Internet options and Firefox when a specific LAN is connected to
**Shutdown/restart/logoff (forced/remote??)
*Locate other computers (by name & IP address) on the network
*send commands to remote PC's
Some things I'd like to add are service pack updates, auto detection of NT version, which would remove the step of asking "are you running Vista, XP or 2000"
I'm going to post the code and feel free to browse. If you think there should be modifications, please let me know and be specific so I can understand where it needs to be fixed.
http://www.tuprox.com/input12.bat
This is a work in progress, so please don't mind the sloppyness. It will be cleaned up as I go. The AV section is a mess but will be cleaned up.
What would you add to this program? What features would be good to add?
Ideas greatly appreciated!!
I welcome any and all advice/suggestions/contributions here and would love someone to work on some sections as well.
I've thought of some things to add and wondered if they would be possible:
****Upon connecting to a Wireless LAN or a LAN, automatically run a script that will automatically map drives associated with that network. THIS WOULD BE AWESOME!!!!! 2nd highest priority!
*** Automatically enable/change proxy settings in Internet options and Firefox when a specific LAN is connected to
**Shutdown/restart/logoff (forced/remote??)
*Locate other computers (by name & IP address) on the network
*send commands to remote PC's
Some things I'd like to add are service pack updates, auto detection of NT version, which would remove the step of asking "are you running Vista, XP or 2000"
I'm going to post the code and feel free to browse. If you think there should be modifications, please let me know and be specific so I can understand where it needs to be fixed.
http://www.tuprox.com/input12.bat
Code: Select all
Echo off
FOR /F "usebackq tokens=1-4,* delims=/ " %%a IN ('%date%') DO (set datestring=%%d-%%b-%%c)
set logfile=c:\logs\%computername%-Sophos-AV-Scan-%datestring%.log
:start
cls
Echo Welcome to System Maintenance setup.
Echo Please select the type of OS you wish to
Echo install this program onto:
Echo 1: Windows 2000
Echo 2: Windows XP
Echo 3: Windows Vista
Echo Q: Quit
choice /c:123Q
if errorlevel 1 set OS#=1
if errorlevel 2 set OS#=2
if errorlevel 3 set OS#=3
if errorlevel 1 set OSname=Windows 2000
if errorlevel 2 set OSname=Windows XP
if errorlevel 3 set OSname=Microsoft Vista
if errorlevel 4 goto Quit
if errorlevel 3 goto menu
if errorlevel 2 goto menu
if errorlevel 1 goto menu
***************************************************
:menu
cls
echo YOU HAVE REACHED THE MENU!!!!
echo You have choosen %OSname%
echo What would you like to schedule? Please
echo select (Q) to Quit or (C) to continue:
echo.
Echo 0: Schedule Task
echo 1: Disk Cleanup
echo 2: Scan Disc
echo 3: Defragment
echo 4: Anti-Virus Scan
echo 5: System Backup
echo 6: Registry Cleanup
echo 7: Remote Administration (enable/disable)
echo 8: Configure Network
echo Q: Quit
choice /c:12345678Q
if errorlevel Q goto quit
if errorlevel 8 goto network
if errorlevel 7 goto remadmin
if errorlevel 6 goto regclean
if errorlevel 5 goto sysbak
if errorlevel 4 goto avscan
if errorlevel 3 goto defrag
if errorlevel 2 goto scandisc
if errorlevel 1 goto discclean
goto semiend
***************************************************
:discclean
echo You have selected Disc Cleanup
pause
goto semiend
***************************************************
:scandisc
echo You have selected Scan Disc
pause
goto semiend
***************************************************
:defrag
echo You have selected Defragment
pause
goto semiend
***************************************************
[b]:avscan
cls
Echo.
echo You have selected to run an anti-Virus Scan
echo.
echo Please enter the drive to scan.
echo C: Drive
echo D: Drive
echo E: Drive
echo X: I selected the wrong AV program
choice /c:CDEX
if errorlevel 1 set avdrivescan=C:
if errorlevel 2 set avdrivescan=D:
if errorlevel 3 set avdrivescan=E:
if errorlevel 4 goto avscan
cd\
mkdir logs
cd\logs
mkdir Sophos
set savlog=c:\logs\Sohpos\SophosAV-%avdrivescan%-%datestring%.log
cls
echo You have choosen %avdrivescan%\ to be scanned
echo for viruses.
echo.
CHOICE /C YN /M "Do you want to do a full scan of the selected drive?"
if errorlevel 2 goto avscanpath
if errorlevel 1 goto avoptions
:avoptions
cls
echo.
echo What options would you like to include on the scan?
echo.
echo 1. Disinfect, remove, MBR, archive, full, recessive, logging
echo 2. Full scan only (will not disinfect or remove threats) w/ logging
echo 3. Custom Scan
choice /c:123
if errorlevel 3 goto avchoice
if errorlevel 2 goto avscan2
if errorlevel 1 goto avscan1
:avscanpath
:avchoice
cls
echo You have selected Anti-Virus Scan
echo.
echo What Anti-Virus program is on your system?
echo.
echo A: AVG
echo S: Sophos
choice /c:AS
if errorlevel 1 set /A AVnum=1
if errorlevel 2 set /A AVnum=2
if errorlevel 2 goto sophos1
if errorlevel 1 goto avg1
:sophos1
set av=Sophos
goto sophoscustom
:avg1
set av=AVG
goto avgcustom
:sophoscustom
cls
echo You have chosen %av% Anti-Virus
Echo Please select the options to include in the scan:
echo.
Echo Please select the options that you wish to enable
echo Select "Y" for yes and "N" for No
echo.
CHOICE /C YN /M "Scan inside dynamically compressed executables"
if errorlevel 1 set av1=-sc
if errorlevel 2 set av1=
CHOICE /C YN /M "Full scan"
if errorlevel 1 set av2=-f
if errorlevel 2 set av2=
CHOICE /C YN /M "Disinfect infected items"
if errorlevel 1 set av3=-di
if errorlevel 2 set av3=
CHOICE /C YN /M "Run silently (do not list files swept)"
if errorlevel 1 set av4=-s
if errorlevel 2 set av4=
CHOICE /C YN /M "Ask for confirmation before disinfection/deletion"
if errorlevel 1 set av5=-c
if errorlevel 2 set av5=
CHOICE /C YN /M "Sound bell on virus detection"
if errorlevel 1 set av6=-b
if errorlevel 2 set av6=
CHOICE /C YN /M "Scan all files"
if errorlevel 1 set av7=-all
if errorlevel 2 set av7=
CHOICE /C YN /M "Do recursive scan"
if errorlevel 1 set av8=-rec
if errorlevel 2 set av8=
CHOICE /C YN /M "Remove infected objects"
if errorlevel 1 set av9=-remove
if errorlevel 2 set av9=
CHOICE /C YN /M "Display names of files as they are scanned"
if errorlevel 1 set av10=-dn
if errorlevel 2 set av10=
CHOICE /C YN /M "Display nothing except on error or virus"
if errorlevel 1 set av11=-ss
if errorlevel 2 set av11=
CHOICE /C YN /M "Write to log file
if errorlevel 1 set av12=-p=
if errorlevel 2 set av12=
CHOICE /C YN /M "Scan master boot records on all hard disks"
if errorlevel 1 set av13=-mbr
if errorlevel 2 set av13=
CHOICE /C YN /M "Scan boot sector of each drive listed"
if errorlevel 1 set av14=-bs=
if errorlevel 2 set av14=
CHOICE /C YN /M "Scan for Macintosh viruses"
if errorlevel 1 set av15=-mac
if errorlevel 2 set av15=
CHOICE /C YN /M "Scan boot sector in bootable image of each CD drive listed"
if errorlevel 1 set av16=-cdr=
if errorlevel 2 set av16=
hostname>>%logfile%
whoami>>%logfile%
date /T>>%logfile%
time /T>>%logfile%
hostname>>%savlog%
whoami>>%savlog%
date /T>>%savlog%
time /T>>%savlog%
echo savcli32.exe %av1%%av2%%av3%%av4%%av5%%av6%%av7%%av8%%av9%%av10%%av11%%av12%%savlog% %av13%%av14%%avdrivescan% %av15%%av16%%
REM Print time of completion
time /T>>%savlog%
date /T>>%savlog%
time /T>>%logfile%
date /T>>%logfile%
type %savlog%>>%logfile%
cd\program files\sophos\sophos anti-virus\
sav32cli c: -f -b -remove -sc -nc -mbr -bs=c: -all -rec -di -archive -
p=c:\logs\SophosAV-c.log
type c:\logs\SophosAV-%avdrivescan%.log>>c:\logs\%computername%-SophosAV-%
datestring%.log
REM Print time of completion
time /T>>c:\logs\SophosAV.log
echo.
echo SophosCustom sub section is now done
pause
goto quit
[/b]*******************
:avgcustom
cls
echo You have chosen %av% Anti-Virus
goto avcustomsub
:avscan1
echo %av% Anti-Virus is performing a full scan
echo of your computer. Please be patient and let
echo the process complete. You may minimize this
echo screen if necessary.
echo This may take many hours to complete.
pause
Echo off
REM Change to working directory
cd\program files\sophos\sophos anti-virus\
hostname>>%logfile%
whoami>>%logfile%
date /T>>%logfile%
time /T>>%logfile%
REM Sophos Scan and clean
cd\program files\sophos\sophos anti-virus\
sav32cli c: -f -b -remove -sc -nc -mbr -bs=c: -all -rec -di -archive -
p=c:\logs\SophosAV-c.log
type c:\logs\SophosAV-%avdrivescan%.log>>c:\logs\%computername%-SophosAV-%
datestring%.log
REM Print time of completion
time /T>>c:\logs\SophosAV.log
pause
:avscan2
pause
***************************************************
goto semiend
:sysbak
echo You have selected System Backup
pause
goto semiend
***************************************************
:regclean
echo You have selected Registry Cleaner
pause
goto semiend
***************************************************
:remadmin
echo You have selected Remote Administration
pause
goto semiend
***************************************************
:network
echo You have selected Configure Network
pause
goto semiend
***************************************************
:Quit
cls
echo You have choosen to exit the configuration.
CHOICE /C YN /M "Do you really want to exit?"
if errorlevel 2 goto start
if errorlevel 1 goto end
pause
***************************************************
:Semiend
echo something happened in the program that isnt' supposed to
echo please debug the program
goto start
:end
set osname=
set os#=
This is a work in progress, so please don't mind the sloppyness. It will be cleaned up as I go. The AV section is a mess but will be cleaned up.
What would you add to this program? What features would be good to add?
Ideas greatly appreciated!!