« Microsoft Essential Business Server Released to Manufacturing | Main | VMware ESX Update 2 Now Officially Validated By the Microsoft Server Virtualization Validation Program (SVVP) »
Friday
Sep122008

RepAdmin Script

Here is a script I wrote a few years ago to email repadmin results to a specified email account. This provides a simple report on Active Directory replication. You can set this up as a scheduled task and receive a morning replication summary report. Someone asked me for this yesterday so I thought I’d post it here. 

 

'***************************************************
'Created By: Dustin Hannifin
'Revised By:
'Creation Date: 08/01/2004
'Revision Date: 05/23/2007
'
'Description:
'    Script Runs the repadmin.exe with the /replsum option
'    and emails the results to specified email addresses.
'
'Change Log
'
'
'
'
'**************************************************************************
'Make all configuration changes in this section ONLY!!
'
'
'Enter email addresses here seperated by comma
strToMailAddresses = "me@mycompany.com,person2@mycompany.com"

'Enter From Address Here
strFromMailAddress = "RepMonitor@mycompany.com"

'Enter Subject Here
strMailSubject = "Daily AD Replication Summary"

'Enter Mail Server Hostname here
strMailServer = "MyEmailServerName"

'Enter SMTP Server's Portnumber here
strMailServerPort = 25
'
'
'End Configruation Section. Do NOT modify configuration below this section
'
'**************************************************************************

Set objShell = Wscript.CreateObject("Wscript.Shell")
Set objExecObject = objShell.Exec ("%comspec% /c repadmin.exe /replsum")

Do Until objExecObject.StdOut.AtEndOfStream
    strRepResults = objExecObject.StdOut.ReadAll()
Loop

Set objEmail = CreateObject("CDO.Message")
objEmail.From = "repadmin@mydomain.com"
objEmail.TO = strToMailAddresses
objEmail.Subject = strMailSubject
objEmail.Textbody = strRepResults
objEmail.Configuration.Fields.Item _
    ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objEmail.Configuration.Fields.Item _
    ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = strMailServer
objEmail.Configuration.Fields.Item _
    ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = strMailServerPort
objEmail.Configuration.Fields.Update
objEmail.Send

 

Enjoy. If you have enhancements for this script please comment so I can post them.

Reader Comments

There are no comments for this journal entry. To create a new comment, use the form below.

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
Post:
 
Some HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>