helper/Run.ps1
Remove-Module ExCmdReport -ErrorAction SilentlyContinue Import-Module ExCmdReport $credential = Get-Credential Connect-ExchangeOnline -Credential $credential # Get the audit log events $events = Get-ExCmdLog -searchParamHash @{ StartDate = ((Get-Date).AddHours(-72)) EndDate = ((Get-Date)) ExternalAccess = $false } -Verbose -resolveAdminName # Build report parameters $report = @{ SendEmail = $true From = 'admin@poshlab.ml' To = 'june@poshlab.ml' smtpServer = 'smtp.office365.com' port = 587 UseSSL = $true Credential = $credential TruncateLongValue = 50 } # Create report $events | Write-ExCmdReport @report -Verbose |