• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 514
  • Last Modified:

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

QuestCommandLets / Powershell script what would run a health check for the domain controllers and then send an email with results?  Is this possible?
0
mjm21
Asked:
mjm21
  • 5
  • 2
1 Solution
 
mjm21Author Commented:
QuestCommandLets / Powershell script what would run a health check for the domain controllers and then send an email with results?  Is this possible?
0
 
kevinhsiehCommented:
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
 
mjm21Author Commented:
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!

 
kevinhsiehCommented:
Would be best if you posted the script and assigned that as the answer, 0 points so that others can see it.
0
 
mjm21Author Commented:
Will do
0
 
mjm21Author Commented:
##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
 
mjm21Author Commented:
Was able to get an internal source to help
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 5
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now