12-28-2024, 02:57 AM
You know that Event ID 4792 in Windows Server? It pops up whenever someone deletes a group through an LDAP query. I mean, LDAP is just how the server talks to Active Directory for user stuff. This event logs the whole thing in the Security log of Event Viewer. It captures who did it, like the account name, the workstation involved, and even the exact time stamp. Sometimes it flags the process ID too, if it's digging into admin changes. But here's the kicker, it only triggers if auditing is on for account management. Without that, you might miss these deletions entirely. And deletions like this could mean someone messing with your groups on purpose, or just a sloppy cleanup. I always check it because it helps spot unauthorized tweaks to permissions. You can find it under Windows Logs, then Security in Event Viewer.
Now, to keep an eye on it with an email alert, fire up Event Viewer first. I do this all the time on servers I manage. Right-click the Security log and pick Create Custom View. You set the filter for Event ID 4792 there. Make sure it's pulling from the right source, like Microsoft-Windows-Security-Auditing. Once that's saved, you attach a task to it. Go to the Actions tab in the custom view properties. Choose Create Task, and name it something simple like LDAPDeleteAlert. In the task settings, under Triggers, it links to your event filter. Then, for the action, you select Send an email. Yeah, it's built-in there. You fill in your SMTP server details, the to and from addresses, and a quick message about the deletion. I like adding the event details in the body so you know right away. Set it to run whether user is logged on or not, and check for highest privileges if needed. Test it by simulating a group delete if you can, just to see the ping. That way, you get notified fast without staring at logs all day.
And speaking of keeping things safe from mishaps like sudden deletions, you might wanna look into solid backups too. That's where BackupChain Windows Server Backup comes in handy for me. It's this straightforward Windows Server backup tool that handles full system images without the headaches. Plus, it backs up virtual machines running on Hyper-V seamlessly. I love how it schedules everything automatically and verifies files to avoid corruption surprises. The benefits? Quick restores that get you back online in minutes, and it supports incremental backups to save space. No more losing days of work to a rogue delete or crash.
Note, the PowerShell email alert code was moved to this post.
Now, to keep an eye on it with an email alert, fire up Event Viewer first. I do this all the time on servers I manage. Right-click the Security log and pick Create Custom View. You set the filter for Event ID 4792 there. Make sure it's pulling from the right source, like Microsoft-Windows-Security-Auditing. Once that's saved, you attach a task to it. Go to the Actions tab in the custom view properties. Choose Create Task, and name it something simple like LDAPDeleteAlert. In the task settings, under Triggers, it links to your event filter. Then, for the action, you select Send an email. Yeah, it's built-in there. You fill in your SMTP server details, the to and from addresses, and a quick message about the deletion. I like adding the event details in the body so you know right away. Set it to run whether user is logged on or not, and check for highest privileges if needed. Test it by simulating a group delete if you can, just to see the ping. That way, you get notified fast without staring at logs all day.
And speaking of keeping things safe from mishaps like sudden deletions, you might wanna look into solid backups too. That's where BackupChain Windows Server Backup comes in handy for me. It's this straightforward Windows Server backup tool that handles full system images without the headaches. Plus, it backs up virtual machines running on Hyper-V seamlessly. I love how it schedules everything automatically and verifies files to avoid corruption surprises. The benefits? Quick restores that get you back online in minutes, and it supports incremental backups to save space. No more losing days of work to a rogue delete or crash.
Note, the PowerShell email alert code was moved to this post.

