mirror of
https://github.com/admindroid-community/powershell-scripts.git
synced 2025-12-17 08:25:20 +00:00
Audit emails sent using SendAs
Audit emails sent using SendAs
This commit is contained in:
parent
8e83e5e12a
commit
afbaefe360
@ -1,4 +1,24 @@
|
||||
|
||||
<#
|
||||
=============================================================================================
|
||||
Name: Audit Senas emails
|
||||
Description: This script monitors emails that sent using SendAs permission
|
||||
Version: 1.0
|
||||
Website: o365reports.com
|
||||
|
||||
Script Highlights:
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
|
||||
1.The script uses modern authentication to retrieve audit logs.
|
||||
2.The script can be executed with MFA enabled account too.
|
||||
3.Exports report results to CSV file.
|
||||
4.Helps to find out who sent email from a shared mailbox.
|
||||
5.Allows you to generate send as email audit report for a custom period.
|
||||
6.Automatically installs the EXO V2 module (if not installed already) upon your confirmation.
|
||||
7.The script is scheduler-friendly. i.e., Credential can be passed as a parameter instead of saving inside the script.
|
||||
|
||||
For detailed script execution: https://o365reports.com/2022/03/30/audit-send-as-emails-in-microsoft-365-using-powershell
|
||||
============================================================================================
|
||||
#>
|
||||
Param
|
||||
(
|
||||
[Parameter(Mandatory = $false)]
|
||||
@ -208,28 +228,22 @@ If($OutputEvents -eq 0)
|
||||
}
|
||||
else
|
||||
{
|
||||
Write-Host `nThe output file contains $OutputEvents audit records
|
||||
Write-Host `nFor more Office 365 related PowerShell scripts, visit: https://o365reports.com -ForegroundColor Cyan
|
||||
Write-Host `nThe output file contains $OutputEvents audit records `n
|
||||
if((Test-Path -Path $OutputCSV) -eq "True")
|
||||
{
|
||||
Write-Host `nThe Output file availble in $OutputCSV -ForegroundColor Green
|
||||
Write-Host " The Output file availble in:" -NoNewline -ForegroundColor Yellow
|
||||
Write-Host $OutputCSV
|
||||
$Prompt = New-Object -ComObject wscript.shell
|
||||
$UserInput = $Prompt.popup("Do you want to open output file?",`
|
||||
0,"Open Output File",4)
|
||||
If ($UserInput -eq 6)
|
||||
{
|
||||
Invoke-Item "$OutputCSV"
|
||||
Invoke-Item "$OutputCSV"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#Disconnect Exchange Online session
|
||||
Disconnect-ExchangeOnline -Confirm:$false -InformationAction Ignore -ErrorAction SilentlyContinue
|
||||
|
||||
<#
|
||||
============================================================================================
|
||||
Description: This script monitors emails that sent using SendAs permission
|
||||
Website: o365reports.com
|
||||
For detailed script execution: https://o365reports.com/2022/03/30/audit-send-as-emails-in-microsoft-365-using-powershell
|
||||
============================================================================================
|
||||
#>
|
||||
Write-Host `n~~ Script prepared by AdminDroid Community ~~`n -ForegroundColor Green
|
||||
Write-Host "~~ Check out " -NoNewline -ForegroundColor Green; Write-Host "admindroid.com" -ForegroundColor Yellow -NoNewline; Write-Host " to get access to 1800+ Microsoft 365 reports. ~~" -ForegroundColor Green `n`n
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user