04-28-2024, 08:08 PM
You know that event ID 25217 in the Event Viewer on Windows Server? It's basically the log entry that pops up whenever someone runs the New-MailUser command in Exchange. That command creates a new mail user account, like adding an external contact or a shared mailbox without a full license. I see it under the Security log or maybe the Application log, depending on your auditing setup. It records who did it, from which machine, and the exact time. Pretty sneaky if someone's messing around without permission. And it includes details like the user's name they tried to add, or if it failed for some reason. You can filter for it right in Event Viewer to spot these right away. But if you want to stay on top without checking constantly, set up monitoring with an email alert. I do this by creating a custom view in Event Viewer first. Go to the Action pane, pick Create Custom View, then select the logs you want, like Security, and filter by event ID 25217. Name it something simple, like MailUser Alerts. Now, to get that email kick, use a scheduled task tied to it. In Task Scheduler, make a new task that triggers on events from your custom view. Set it to run every few minutes or on event occurrence. For the action, have it launch a program that sends the email, but keep it basic with built-in tools. You tweak the triggers to watch for that specific ID. Test it by running the command yourself and see if the alert fires. It's straightforward once you poke around the screens. Hmmm, or you could attach it to logon events too if needed. Anyway, that keeps you looped in without hassle.
Shifting gears a bit since we're talking server monitoring and keeping things secure, I've been using BackupChain Windows Server Backup for my Windows Server backups lately. It's this solid tool that handles full server images and also backs up virtual machines running on Hyper-V without much fuss. You get fast incremental backups that save time, plus easy restores that don't lock you out during recovery. The encryption keeps data safe, and it runs quietly in the background so your server stays snappy. I like how it alerts you on failures too, tying right into that event watching vibe.
At the end here is the automatic email solution.
Note, the PowerShell email alert code was moved to this post.
Shifting gears a bit since we're talking server monitoring and keeping things secure, I've been using BackupChain Windows Server Backup for my Windows Server backups lately. It's this solid tool that handles full server images and also backs up virtual machines running on Hyper-V without much fuss. You get fast incremental backups that save time, plus easy restores that don't lock you out during recovery. The encryption keeps data safe, and it runs quietly in the background so your server stays snappy. I like how it alerts you on failures too, tying right into that event watching vibe.
At the end here is the automatic email solution.
Note, the PowerShell email alert code was moved to this post.

