o365

Get O365 AuditLog and sign-ins:

# install modules 
Install-Module -Name ExchangeOnlineManagement
Install-Module -Name MSOnline
Install-Module -Name AzureAD


# Import required modules
Import-Module MSOnline
Import-Module AzureAD
Import-Module ExchangeOnlineManagement

# Connect to services
Connect-MsolService
Connect-AzureAD
Connect-ExchangeOnline

# Define the date from which you want to start the search
$startDate = Get-Date -Date "yyyy-MM-dd" # Replace yyyy-MM-dd with your start date

# Search the audit log
$auditLogEntries = Search-UnifiedAuditLog -StartDate $startDate -EndDate (Get-Date)

# Sign-Ins 
Get-AzureADAuditSignInLogs | Export-Csv AzureSignIns.csv

# Export the results
$auditLogEntries | Export-csv AuditLog.csv

export Exchange mailbox:

Exchange Online/ O365:

https://www.codetwo.com/admins-blog/export-microsoft-365-mailboxes-to-pst-powershell/

Powershell Audit Log extraction - o365:

on prem:

o365 Log location:

  1. Log in to your Microsoft 365 account

  2. In the left-hand pane of the Security & Compliance Center, click on “Audit Log Search”

  3. Choose the activities and dates you want to view, as well as any specific users, files, folders, or sites you want to filter

  4. Click “Search”

  5. Click on a specific event to open the “Details” page

  6. Filter or export the results

Activities: Under Exchange mailbox activities, select one or both of the following activities:

  • New-InboxRule Create new inbox rule from Outlook Web App. This activity returns audit records when inbox rules are created using Outlook web app or Exchange Online PowerShell.

  • Updated inbox rules from Outlook client. This activity returns audit records when inbox rules are created, modified, or removed using the Outlook desktop clien

Last updated