Solved

QuestCommandLets / Powershell script what would run a health check for the domain controllers and then send an email with results

Posted on 2012-03-16
8
506 Views
Last Modified: 2012-03-27
QuestCommandLets / Powershell script what would run a health check for the domain controllers and then send an email with results?  Is this possible?
0
Comment
Question by:mjm21
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 2
8 Comments
 

Author Comment

by:mjm21
ID: 37730731
QuestCommandLets / Powershell script what would run a health check for the domain controllers and then send an email with results?  Is this possible?
0
 
LVL 42

Expert Comment

by:kevinhsieh
ID: 37731925
Not familiar with the Quest tools. Are you looking for DCDiag type output? You could run a simple batch file:

dcdiag > dcdiag.txt
blat -server smtp.yourcompany.com -to you@yourcompany.com -f from@yourcompany.com -subject "DCdiag output from %date% %time%" -bodyF dcdiag.txt
0
 

Author Comment

by:mjm21
ID: 37743797
I've requested that this question be deleted for the following reason:

Staff member created vb script for this
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 42

Expert Comment

by:kevinhsieh
ID: 37743798
Would be best if you posted the script and assigned that as the answer, 0 points so that others can see it.
0
 

Author Comment

by:mjm21
ID: 37749569
Will do
0
 

Accepted Solution

by:
mjm21 earned 0 total points
ID: 37753867
##FILE DATE, TIME STAMP
$a = get-date
$filetimestamp = [string]$a.year + [string]"{0:D2}" -f $a.month + [string]$a.day + [string] $a.hour + [string]$a.minute

foreach ($SERVER_NAME in get-content ".\serverlist.txt")
{
    echo **************************** DCDIAG_CHECK_FOR_$SERVER_NAME **************************** > dcdiag_$SERVER_NAME.txt
    dcdiag /s:$SERVER_NAME /q | out-file -append dcdiag_$SERVER_NAME.txt
    (gc dcdiag_$SERVER_NAME.txt) | ? {$_.trim() -ne "" } | set-content dcdiag_$SERVER_NAME.txt
    type dcdiag_$SERVER_NAME.txt >> DCDIAG_$filetimestamp.txt
    del dcdiag_$SERVER_NAME.txt
   
}

type DCDIAG_$filetimestamp.txt > tmp.txt

Repadmin /replsum /bysrc /bydest /sort:delta | out-file repadmin.txt
(gc repadmin.txt) | ? {$_.trim() -ne "" } | set-content repadmin.txt
type REPADMIN.txt > REPADMIN_$filetimestamp.txt
del REPADMIN.txt

ECHO ******************************** AD REPLICATION CHECK *********************************  >> tmp.txt

type REPADMIN_$filetimestamp.txt >> tmp.txt

$emailFrom = "username@test.net"
$emailTo = "username@test.net"
$subject = "AD Health Checks for test.net"
$body = (Get-Content tmp.txt | out-string)
$smtpServer = "smt.test.net"
$smtp = new-object Net.Mail.SmtpClient($smtpServer)
$smtp.Send($emailFrom, $emailTo, $subject, $body)

del tmp.txt
0
 

Author Closing Comment

by:mjm21
ID: 37770417
Was able to get an internal source to help
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article describes how to set permissions to allow a limited-permissions user to start and stop a particular System Service.   It is always best to give users only the permissions that they need to perform their job, so tweaking particular permi…
When you upgrade from Windows 8 to 8.1 or to Windows 10 or if you are like me you are on the Insider Program you may find yourself with many 450MB recovery partitions.  With a traditional disk that may not be a problem but with relatively smaller SS…
This video Micro Tutorial explains how to clone a hard drive using a commercial software product for Windows systems called Casper from Future Systems Solutions (FSS). Cloning makes an exact, complete copy of one hard disk drive (HDD) onto another d…
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question