Advertisement

01.25.2008 at 05:21PM PST, ID: 23112822
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.2

Need help with writing batch files to automate "dcdiag" and "repadmin" on eight DCs

Asked by bndit in Windows Batch Scripting, MS DOS, Windows 2003 Server

Tags: , ,

Hello Experts,

I'm by no means a programmer, and have only used batch files to do very basic things in the past. However, I'm attempting to automate maintenance procedures on eight DCs without user/administrator interaction. I would like to run "dcdiag" and "repadmin" on all eight DCs automatically and email a notification to an email distribution list once the jobs have run. Let me outline the steps:

1) I want to locate my batch files on each DC in C:\SCRIPTS. <I got this one..>
2) I want to schedule the batch files on each DC to run once a week. <I got this one...>
3) I want to run "dcdiag" and "repadmin". I want to output the results to two different text files respectively. The name convention I want to use for each of this files is: "NETBIOSname-dcdiag-MMDDYY.txt" and "NETBIOSname-repadmin-replsum-MMDDYY.txt". <this is my problem!!...>
4) I want to copy the files created in step 3 to a network location \\servername\sharename. <I got this one..>
5) I want to send an automatic email notification to an email distribution list once the schedule task has completed. I researched and came up with BLAT as a way to do this. I tested this on a test machine, and it worked OK. If there's another way to do it without using BLAT, I would like to know. <I'll say that I have this one unless someone has a better way of doing it...>

Here's some code snippets that I've been able to put together:
-----Code to run DCDIAG and output the results-----
@ECHO OFF
DCDIAG /v /e > C:\ADDiag\NETBIOSname-dcdiag-MMDDYY.txt
BLAT NETBIOSname-dcdiag-MMDDYY.txt -to <username>@<mydomain> -s Subject -priority 1

My biggest challenge has been how to generate the file name automatically to fit my name convention. The following code snippet finds the FQDN and requires the administrator to type the host's IP address.
@ECHO OFF
ECHO.
IF [%1]==[] GOTO Syntax
ECHO.%1 | FIND "?" >NULL
IF NOT ERRORLEVEL 1 GOTO Syntax
FOR /F "tokens=2 delims= " %%A IN ('PING -a %1 -n 1 ^| FIND "[%1]"') DO ECHO.%%A
GOTO:EOF

:Syntax
ECHO.
ECHO Usage: HOSTNAME ^<IP_address^>
ECHO.Start Free Trial
 
Loading Advertisement...
 
[+][-]01.25.2008 at 11:06PM PST, ID: 20748755

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Windows Batch Scripting, MS DOS, Windows 2003 Server
Tags: Microsoft, MS-DOS, 5.2.3790
Sign Up Now!
Solution Provided By: leew
Participating Experts: 1
Solution Grade: A
 
 
[+][-]01.28.2008 at 02:05PM PST, ID: 20763363

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01.28.2008 at 02:19PM PST, ID: 20763476

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01.28.2008 at 02:23PM PST, ID: 20763506

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01.28.2008 at 02:29PM PST, ID: 20763567

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01.28.2008 at 02:35PM PST, ID: 20763629

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01.30.2008 at 12:21PM PST, ID: 20780792

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01.31.2008 at 03:25PM PST, ID: 20792525

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628