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
495 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
  • 5
  • 2
8 Comments
 

Author Comment

by:mjm21
Comment Utility
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
Comment Utility
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
Comment Utility
I've requested that this question be deleted for the following reason:

Staff member created vb script for this
0
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
LVL 42

Expert Comment

by:kevinhsieh
Comment Utility
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
Comment Utility
Will do
0
 

Accepted Solution

by:
mjm21 earned 0 total points
Comment Utility
##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
Comment Utility
Was able to get an internal source to help
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Many admins will agree: WSUS is is a nice invention but using it on the client side when updating a newly installed computer is still time consuming as you have to do several reboots and furthermore, the procedure of installing updates, rebooting an…
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…
In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …
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…

763 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now