-
Jon Irish commented on
Perform Active Directory security assessment using PowerShell 1 year, 2 months ago
One other question for the group, has anyone found documentation on everything that is allowed in the config.ini file?
-
Jon Irish commented on
Perform Active Directory security assessment using PowerShell 1 year, 2 months ago
First, I am NOT a programmer 😉 I hacked together some code to get the email functionality working without using the deprecated Send-MailMessage commandlet. Anyway, I’m sure this can be consolidated, but it works:
#———————————————————————————————————————————————
# Sending Mail
#———————————————————————————————————————————————if($SendEmail -eq ‘Yes’ ) {
# Send ADHealthCheck Report
if(Test-Path $HealthReport)
{
try {
$Message = new-object Net.Mail.MailMessage
$smtp = new-object Net.Mail.SmtpClient(“smtp.gmail.com”, 587)
$smtp.Credentials = New-Object System.Net.NetworkCredential(“xxxxxxx@gmail.com”, “GmailPassword”);
$smtp.EnableSsl = $true
$smtp.Timeout = 400000
$Message.From = “xxxxxxx@gmail.com”
$Message.To.Add(“xxxxxxx@gmail.com”)
$Message.Attachments.Add(“$HealthReport”)
$Message.Subject = “AD Health Check Report”
$Message.Body = “Please find AD Health Check report attached.”
$smtp.Send($Message)
} catch {
Write-Log ‘Error in sending AD Health Check Report!’
}
}#Send an ERROR mail if Report is not found
if(!(Test-Path $HealthReport))
{try {
$Message = new-object Net.Mail.MailMessage
$smtp = new-object Net.Mail.SmtpClient(“smtp.gmail.com”, 587)
$smtp.Credentials = New-Object System.Net.NetworkCredential(“xxxxxxx@gmail.com”, “GmailPassword”);
$smtp.EnableSsl = $true
$smtp.Timeout = 400000
$Message.From = “xxxxxxx@gmail.com”
$Message.To.Add(“xxxxxxx@gmail.com”)
$Message.Subject = “AD Health Check Report”
$Message.Body = “ERROR: NO AD Health Check report.”
$smtp.Send($Message)
} catch {
Write-Log ‘Unable to send Error mail.’
}
}}
else
{
Write-Log “As Send Email is NO so report through mail is not being sent. Please find the report in Script directory.”
} -
Jon Irish commented on
Perform Active Directory security assessment using PowerShell 1 year, 2 months ago
Has anyone figured out a fix for the SNMP function being deprecated? I get an error when trying to use my gmail account. I’ll start researching a fix, but if someone already has a work-around, why reinvent the wheel?
-
-
Jon Irish liked the comment of Jon Irish (Rank: 1)
on Perform Active Directory security assessment using PowerShell. (So far, Jon Irish (Rank: 1)
has 1 likes for this comment) 1 year, 2 months ago