compwiz32 / PSADHealth

A toolkit of AD specific health checks that you can run in your environment to ensure your Active Directory is running optimally.
GNU General Public License v2.0
149 stars 19 forks source link

Review of Get-ADLastBackupDate function #104

Open Rapidhands opened 3 years ago

Rapidhands commented 3 years ago

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