Active Directory: Task Scheduling Health Check Report.
Active Directory is one of the most import services of any network. Most of the administrators need to check the health of Active Directory on daily basis. To make this job more easy and efficient, we can schedule a script in Windows Server Task Scheduler to send the Active Directory Health Check report on daily basis to the administrator email address or a distribution group email address where a team is responsible for Active Directory Sever's and Services.
Download
Here is the script you can download:
Active Directory Health Check Script
Steps
Place your script somewhere in C:\ and open the Task Scheduler.
Click on Create Basic Task
Give a friendly name to your scheduled task and click Next
You can choose timings of your task, but it's best to select the Daily option so that you have everyday report in your inbox. Click Next
Set date and time as per your requirement and click Next
Select the first option as we are going to run a PowerShell Script. Click Next
In Program/Script put the value as "PowerShell"
In Add Arguments put the following value which points to your Script:
-file "C:\Program Files\Update Services\ADHealthCheck\ADHealthCheck.ps1"
Click Next to continue
You can open the property of the Task to review the configurations. Click Finish
At this point, you have configured your script to be run on a daily basis at a particular time. For email configurations, you need to modify the script for the following values.
$smtphost = "smtp-server.yourdomain.net" (your SMTP address, you can put IP address on your Exchange or FQDN of your email)
$from = "ADHealthReport@yourdomain.net" (Any email id in from you like to see in Email)
$email1 = "ad-admins@yourdomain.net" (Here you can define a valid email address of your administrators or a team mailbox)
Save the script.
This is how the email will look in your inbox.