?
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
Medium Priority
?
510 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

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

The way I use Experts Exchange to assist me in analyzing and diagnosing a problem is I first enter a Verbose Question at Experts Exchange like: Office 2007 will hang when opening and saving files I then launch WordPad (any text editor will do) an…
Ever notice how you can't use a new drive in Windows without having Windows assigning a Disk Signature?  Ever have a signature collision problem (especially with Virtual Machines?)  This article is intended to help you understand what's going on and…
Windows 8 comes with a dramatically different user interface known as Metro. Notably missing from the new interface is a Start button and Start Menu. Many users do not like it, much preferring the interface of earlier versions — Windows 7, Windows X…
Windows 8 came with a dramatically different user interface known as Metro. Notably missing from that interface was a Start button and Start Menu. Microsoft responded to negative user feedback of the Metro interface, bringing back the Start button a…

771 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