By advance, sorry for my english, it's not my mother tongue.
First : one problem identified
Write-Verbose "Last Active Directory backup occurred on $LastBackup! $Result days is less than the alert criteria of $MaxDaysSinceBackup day."
Just locatedf before the If ... else statement ==> useless. The good place is on the else statement.
Suggestion : I've always read "one function, one action".
In this function, 2 actions : Get the ADLastbackupDate (and compare to ref $MaxDaysSinceBackup)
but also Send-MailMessage (New-SlackPost is commented).
I'm thinking that the send-MailMessage should be processed by another function called on condition (i.e. param $mail=$true)
Hi Mike,
By advance, sorry for my english, it's not my mother tongue.
First : one problem identified Write-Verbose "Last Active Directory backup occurred on $LastBackup! $Result days is less than the alert criteria of $MaxDaysSinceBackup day." Just locatedf before the If ... else statement ==> useless. The good place is on the else statement.
Suggestion : I've always read "one function, one action". In this function, 2 actions : Get the ADLastbackupDate (and compare to ref $MaxDaysSinceBackup) but also Send-MailMessage (New-SlackPost is commented). I'm thinking that the send-MailMessage should be processed by another function called on condition (i.e. param $mail=$true)
regards Olivier