Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations dencom on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Domain Startup Script Batch Issues

Status
Not open for further replies.

sromine

Technical User
Apr 21, 2006
38
US
I work for a library and we are trying to automate a lot of maintenance routines as we have numerous branches over a large area. I am hoping someone could help me with troubleshooting a domain startup script routine. I have placed all the relevant script and logs below this post. dos is the only scripting language i know at this point, so moving to vbscript is not an option at this point for this project (hope to move to the more robust vbscript skill soon)....

We have our domain configured to run a script that points to a .bat file on our library server. It is done this way because the county is in charge of the domain administration and we wanted a way to run scripts against our OU without having to involved them each and everytime.

What is happening is that if I look at the log we are creating sometimes the domain scripting works and sometimes it doesn’t. More specifically it logs through part of the process and then hangs at some point, but doesn’t always hang at the same point and not always on the same machine. I sometimes think that it is in fact running the script but not properly logging back, only because I think I see the hard drive activity light and hear the familiar sound of cleanmgr.exe running, but I am not sure.

Any idea why sometimes this would run all the way through and sometimes not?
Any ideas of ways to better track what exactly is going on for troubleshooting reasons?

I have a suspicion that our network is kind of slow and that it is timing out at some points? I will say that it appears the portion of the script within staff_maint.bat that echos the initial access always works it seems. It is the rest of the script that works on and off…..


Domain Startup Script:
Code:
'This script will look at the \\dclib3\tech\MaintScript directory 
'to see if there is an update.txt file. If there is, it will call
'the staff_maint.bat batch file.

'Set Objects
Set fso = CreateObject("Scripting.FileSystemObject")
Set WshShell = CreateObject("WSCript.Shell")

'Set variables
strCommand = "\\dclib3\tech\MaintScript\staff_maint.bat"

'Look for the update.txt file
If fso.FileExists("\\dclib3\tech\MaintScript\update.txt") Then
  WshShell.Run strcommand
Else
  WScript.Quit
End IF

staff_maint.bat
Code:
@echo off
rem ***************** Maintenance Script         *************************
rem ***************** Last Modified 10/26/06 seromine    *************************


echo %DATE% %TIME% %COMPUTERNAME% %systemroot% access>>\\dclib3\tech\MaintScript\log\maint_log.txt
IF "%systemroot%"=="C:\WINNT" echo %computername%>>\\dclib3\tech\MaintScript\log\win2000.txt
FINDSTR /C:%computername% \\dclib3\tech\MaintScript\log\diskcleanup.txt > NUL
echo %DATE% %TIME% %COMPUTERNAME% %errorlevel% errorlevel>>\\dclib3\tech\MaintScript\log\maint_log.txt
IF %ERRORLEVEL%==0 goto exit
IF "%systemroot%"=="C:\WINDOWS" call \\dclib3\tech\maintscript\winxp\weekly\winxp_weekly.bat
IF "%systemroot%"=="C:\WINNT" call \\dclib3\tech\maintscript\win2k\weekly\win2k_weekly.bat
echo %DATE% %TIME% %COMPUTERNAME% complcall>>\\dclib3\tech\MaintScript\log\maint_log.txt

exit

:exit

echo %DATE% %TIME% %COMPUTERNAME% %systemroot% exited>>\\dclib3\tech\MaintScript\log\maint_log.txt
winxp_weekly.bat
Code:
@echo off
rem ***************** Maintenance Script for Windows XP *************************
rem ***************** Last Modified 9/29/06 seromine    *************************



rem ******** defrag primary hard drive c    **************

echo %DATE% %TIME% %COMPUTERNAME% winxp weekly CleanMgr_begin>>\\dclib3\tech\MaintScript\log\maint_log.txt

start /MIN \\dclib3\tech\MaintScript\winxp\scripts\Auto_Disk_Cleanup\AutoRegEntriesXP.vbs
echo %DATE% %TIME% %COMPUTERNAME% winxp weekly CleanMgr_setregistry>>\\dclib3\tech\MaintScript\log\maint_log.txt

start /MIN cleanmgr.exe /sagerun:100
echo %computername%>>\\dclib3\tech\MaintScript\log\diskcleanup.txt
echo %DATE% %TIME% %COMPUTERNAME% winxp weekly CleanMgr_run>>\\dclib3\tech\MaintScript\log\maint_log.txt

echo %DATE% %TIME% %COMPUTERNAME% winxp weekly CleanMgr_exit>>\\dclib3\tech\MaintScript\log\maint_log.txt

example of maint_log
Wed 11/01/2006 8:36:22.53 LIBRSBADU5 C:\WINDOWS access
Wed 11/01/2006 8:36:22.68 LIBRSBADU5 1 errorlevel
Wed 11/01/2006 8:36:22.79 LIBRSBADU5 winxp weekly CleanMgr_begin
Wed 11/01/2006 8:36:22.87 LIBRSBADU5 winxp weekly CleanMgr_setregistry
Wed 11/01/2006 8:36:23.03 LIBRSBADU5 winxp weekly CleanMgr_run
Wed 11/01/2006 8:38:51.33 LIBRSBADU3 C:\WINNT access
Wed 11/01/2006 8:38:51.42 LIBRSBADU3 0 errorlevel
Wed 11/01/2006 8:38:51.42 LIBRSBADU3 C:\WINNT exited
Wed 11/01/2006 8:43:19.56 LIBRSBEXT C:\WINDOWS access
Wed 11/01/2006 8:55:48.23 LIBRSBADU2 C:\WINNT access
Wed 11/01/2006 9:00:34.42 LIBCANCRC2 C:\WINDOWS access
Wed 11/01/2006 9:02:37.00 LIBWINCRC2 C:\WINDOWS access
Wed 11/01/2006 9:06:51.75 LIBRSBCAL C:\WINNT access
Wed 11/01/2006 9:06:52.07 LIBRSBCAL 1 errorlevel
Wed 11/01/2006 9:06:52.11 LIBRSBCAL win2k weekly CleanMgr_begin
Wed 11/01/2006 9:06:52.30 LIBRSBCAL winxp weekly CleanMgr_copyregfile
Wed 11/01/2006 9:07:03.64 LIBRSBADU4 C:\WINNT access
Wed 11/01/2006 9:07:06.63 LIBDRNCRC1 C:\WINDOWS access
Wed 11/01/2006 9:07:59.19 LIBRSBCRC7 C:\WINNT access
Wed 11/01/2006 9:10:56.47 LIBDRNSTF C:\WINDOWS access
Wed 11/01/2006 9:15:47.67 LIBRSBADU6 C:\WINDOWS access
Wed 11/01/2006 9:15:47.75 LIBRSBADU6 0 errorlevel
Wed 11/01/2006 9:15:47.76 LIBRSBADU6 C:\WINDOWS exited
Wed 11/01/2006 9:22:03.81 LIBRDSCRC2 C:\WINDOWS access
Wed 11/01/2006 9:19:10.55 LIBRDSCRC1 C:\WINDOWS access
Wed 11/01/2006 9:23:28.54 LIBDRNCRC2 C:\WINDOWS access
Wed 11/01/2006 9:27:31.25 LIBRSBCHI6 C:\WINDOWS access
Wed 11/01/2006 9:27:32.65 LIBRSBCHI6 1 errorlevel
Wed 11/01/2006 9:27:33.90 LIBRSBCHI6 winxp weekly CleanMgr_begin
Wed 11/01/2006 9:27:35.18 LIBRSBPCT C:\WINDOWS access
Wed 11/01/2006 9:27:35.50 LIBRSBPCT 1 errorlevel
Wed 11/01/2006 9:27:35.64 LIBRSBPCT winxp weekly CleanMgr_begin
Wed 11/01/2006 9:30:32.88 LIBYONCRC2 C:\WINNT access
Wed 11/01/2006 9:30:05.43 LIBYONSTF C:\WINDOWS access
Wed 11/01/2006 9:36:28.09 LIBMYTCRC2 C:\WINDOWS access
Wed 11/01/2006 9:44:29.74 LIBRSBCAC C:\WINNT access
Wed 11/01/2006 9:48:40.03 LIBRIDCRC1 C:\WINDOWS access
Wed 11/01/2006 9:49:03.92 LIBRSBPCT C:\WINDOWS access
Wed 11/01/2006 9:49:04.34 LIBRSBPCT 1 errorlevel
Wed 11/01/2006 9:51:12.03 LIBRIDCRC1 C:\WINDOWS access
Wed 11/01/2006 9:51:25.34 LIBMYTCRC1 C:\WINDOWS access
Wed 11/01/2006 9:51:30.75 LIBMYTSTF C:\WINDOWS access
Wed 11/01/2006 9:55:29.29 LIBRSBACF C:\WINDOWS access
Wed 11/01/2006 9:55:29.42 LIBRSBACF 1 errorlevel
Wed 11/01/2006 9:55:29.59 LIBRSBACF winxp weekly CleanMgr_begin
Wed 11/01/2006 10:13:13.14 LIBRSBPCT C:\WINDOWS access
Wed 11/01/2006 10:13:13.34 LIBRSBPCT 1 errorlevel


 
Question for you, why are you running a disk cleanup at login and not automating it to run in the evening when it will not impact your users?

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
 
Good question. A couple of reasons is that we dont have set hours across our branches, and more importantly, this is how my supervisor wants to do it.

I am hoping to get some info specifically about why this particular scripting project is hit and miss, which might give some insight for all of us.
 
Hmm, I would think the hours would not be an issue. I don't know of any libraries open past midnight and would just set it to run then. Battling the desires of a supervisor is another story. I'd present them with options that would steer them toward the decision you feel is best.

For example:
[red]
Hey boss, I've been working on this disk cleanup project. Been encountering some problems with troubleshooting our current solution and I would like your input on what direction I should go.

I can continue to troubleshoot this and it might take me a few weeks to resolve because of my other duties or I could go another direction and just schedule each machine to do this work after midnight and eliminate the use of the batch files altogether. If I go that route, users will benefit from quicker login times and be able to access the systems sooner. Which is your preference?[/red]

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top