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
508 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
Independent Software Vendors: 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

Turn Insights into Action

Communication across every corner of your business is essential to increase the velocity of your application delivery and support pipeline. Automate, standardize, and contextualize your communication processes with xMatters.

Question has a verified solution.

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

This article covers how to install the Microsoft Windows Operating System (OS). What is covered in this article:  > Different Versions and Editions of the Windows OS  > Upgrading versus Fresh Installation of the OS           - Steps to take pr…
The password reset disk is often mentioned as the best solution to deal with the lost Windows password problem. In Windows 2008, 7, Vista and XP, a password reset disk can be easily created. But besides Windows 7/Vista/XP, Windows Server 2008 and ot…
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…
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…

717 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