To be alerted of the condition that a user cannot send mail.
Create a trigger for event id 1078.
Get it to run a cmd file
CMD
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -psconsolefile "E:\Program Files\Microsoft\Exchange Server\v15\bin\exshell.psc1" -file "E:\QuotaBreach.ps1"
QuotaBreach.ps1 Script
###################################################
# Check for existence of output file and delete it.
###################################################
$checkfile = Test-Path "E:\QuotaBreach.htm"
If ($checkfile -like "True")
{
Remove-Item "E:\QuotaBreach.htm"
}
##################################################
# Pull data out of Event and process cmdlet
##################################################
$address = Get-Eventlog -Logname "Application" -Source "MSExchangeIS" | where {$_.eventID -eq 1078} | select -first 1 | select @{n='SID';e={$_.ReplacementStrings[0]}}
foreach ($sid in $address)
{
$mailbox = (get-mailbox $address.sid | select displayname)
Get-MailboxfolderStatistics -Identity $sid.sid -FolderScope All -includeoldestandnewestitems | select FolderPath,@{N="FolderSize (MB)";E={$_.FolderSize.ToMB()}},oldestitemreceiveddate,Newestitemreceiveddate,ItemsInFolder,ItemsInFolderAndSubFolders | convertto-html | out-file E:\QuotaBreach.htm -append
}
#################################################
# Compile email and send
#################################################
$body = get-content E:\QuotaBreach.htm | Out-String
$recipients = "my.name@company.co.uk", "someone.else@company.co.uk"
send-mailmessage -from "post.master@company.co.uk" -to $recipients -subject "$($mailbox.displayname) - Mailbox Breach" -BodyAsHtml -body $body -priority High -smtpServer "mail.company.co.uk"
#################################################