Wednesday, May 22, 2013

PowerShell script to check for unencrypted computers and send email alert

Computers log any decryption event to a log file , if the log file is older than a day
then the process is assumed to have failed , in this case an email is sent to our helpdesk system which automatically logs a call for the helpdesk staff to contact the end user and manually remediate the device

$PSEmailserver = "SMTP.emailserver.com"
$DateToCompare = (Get-date).addDays(-1)
$PathToCheck = "\\fileserver\emcryptionuninstall$\DecryptLimbo\"
$LimboComputers = get-childitem $PathToCheck | Where-object {$_.lastwritetime -lt $DatetoCompare}
$limbocomputers | ForEach-Object { Send-MailMessage -From "Security@company.ie" -To "me@company.ie" -cc "others@company.ie" -Subject "The following computer has not completed the encryption Process" -Body (get-content $_.fullname)}

No comments:

Post a Comment