From dea51f0081b0514428c2b0aee00657466b74b984 Mon Sep 17 00:00:00 2001 From: wpanda Date: Thu, 5 Feb 2026 08:53:36 +0100 Subject: [PATCH] neu script --- .../powershell/get_daily_email_senders.ps1 | 30 +++++++++++++++++++ youtube.md | 2 ++ 2 files changed, 32 insertions(+) create mode 100644 Scripts/powershell/get_daily_email_senders.ps1 create mode 100644 youtube.md diff --git a/Scripts/powershell/get_daily_email_senders.ps1 b/Scripts/powershell/get_daily_email_senders.ps1 new file mode 100644 index 0000000..144ef05 --- /dev/null +++ b/Scripts/powershell/get_daily_email_senders.ps1 @@ -0,0 +1,30 @@ +# PowerShell script to list senders of emails from an on-premise Exchange server for the current day. + +# Set the start and end times for today +$today = Get-Date -Hour 0 -Minute 0 -Second 0 +$tomorrow = (Get-Date).AddDays(1).Date + +Write-Host "Searching for emails sent between $($today) and $($tomorrow)..." + +try { + # Get message tracking logs for sent emails within today's date range + # Filtering by EventID 'SEND' focuses on emails leaving the server or being sent internally. + # Adjust -ResultSize as needed; 'Unlimited' retrieves all, but can be slow for large environments. + $sentEmails = Get-MessageTrackingLog -Start $today -End $tomorrow -EventId "SEND" -ResultSize Unlimited | + Select-Object -ExpandProperty Sender | + Sort-Object -Unique + + if ($sentEmails) { + Write-Host "`nSenders of emails today:`n" + $sentEmails | ForEach-Object { + Write-Host $_ + } + Write-Host "`nTotal unique senders: $($sentEmails.Count)" + } else { + Write-Host "`nNo emails sent today found." + } +} +catch { + Write-Error "An error occurred while retrieving message tracking logs: $($_.Exception.Message)" + Write-Error "Please ensure you have the necessary Exchange management tools installed and are running the script with appropriate permissions." +} diff --git a/youtube.md b/youtube.md new file mode 100644 index 0000000..dbcd7b0 --- /dev/null +++ b/youtube.md @@ -0,0 +1,2 @@ +# WoT +https://www.youtube.com/watch?v=6kn3b5zZnwE