An error occurred while trying to access the audit log

Roger Roger 6,406 Reputation points
2024-05-26T05:58:30.8366667+00:00

Hi All I am getting below error when executing this syntax.

Write-ErrorMessage : |Microsoft.Exchange.Data.ApplicationLogic.AuditLogException|An error occurred while trying to access the audit log. For more details, see the inner exception.

Search-MailboxAuditLog user1@contoso.com -LogonTypes Owner,Delegate,Admin -ShowDetails | Export-CSV C:\temp\output.csv –NoTypeInformation -Encoding utf8

Search-MailboxAuditLog user1@contoso.com -operations HardDelete,SoftDelete,MoveToDeletedItems -LogonTypes Owner,Delegate,Admin -ShowDetails | Export-CSV C:\temp\output.csv –NoTypeInformation -Encoding UTF8
Microsoft Exchange Online
Exchange Server
Exchange Server
A family of Microsoft client/server messaging and collaboration software.
1,337 questions
Microsoft Exchange Online Management
Microsoft Exchange Online Management
Microsoft Exchange Online: A Microsoft email and calendaring hosted service.Management: The act or process of organizing, handling, directing or controlling something.
4,578 questions
Exchange Server Management
Exchange Server Management
Exchange Server: A family of Microsoft client/server messaging and collaboration software.Management: The act or process of organizing, handling, directing or controlling something.
7,669 questions
Microsoft Exchange Hybrid Management
Microsoft Exchange Hybrid Management
Microsoft Exchange: Microsoft messaging and collaboration software.Hybrid Management: Organizing, handling, directing or controlling hybrid deployments.
2,136 questions
0 comments No comments
{count} votes

Accepted answer
  1. Xintao Qiao-MSFT 3,995 Reputation points Microsoft Vendor
    2024-05-27T09:34:45.27+00:00

    Hi,Roger Roger

    Based on your question, I understand that you are experiencing an error when running the command.

    You could provide more information about the error so that I can take the next step in troubleshooting.

    After my tests, the command you provided has no syntax errors and is able to export the .csv file successfully. My test results are shown below.

    csv1A screenshot of a computerDescription automatically generated

    Regarding your error message, you could try the following steps:

    1. The Search-MailboxAuditLog cmdlet may be deprecated. You will need to switch to a Search-UnifiedAuditLog cmdlet. For more information, please check Important Announcement: Deprecation of AdminAuditLog and MailboxAuditLog Cmdlets - Microsoft Community Hub
    2. Ensure that the account performing the action has the required permissions to access the audit log. For permissions needed, please see Find the permissions required to run any Exchange cmdlet | Microsoft Learn. You also could test with another admin account and check if the issue persists.
    3. Check that the parameters are spelled correctly. Ensure that the e-mail address or the path where the file is stored is entered correctly.
    4. Did you get the error with other commands, such as Get-MessageTrackingLog ?

    If my answer is helpful to you, please mark it as the answer so that other users can refer to it. Thank you for your support and understanding.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.