Forum Discussion
dgillespie-adf
Jun 09, 2020Brass Contributor
Powershell script to export all attachments from a user mailbox and save them locally
So it seems there are a bazillion ways to do this but I settled on the simplest one and I am getting an Invoke-RestMethod error. Office 365 exchange online and I am testing with my user account and ...
Jun 12, 2020
Hello Derek,
I would advice you to take a look at New-ComplianceSearch -ContentMatchQuery and include the KQL query "hasattachments:true":
https://docs.microsoft.com/en-us/powershell/module/exchange/new-compliancesearch?view=exchange-ps
After that you can export the results to a PST file.
Take a look at example 4:
https://docs.microsoft.com/en-us/powershell/module/exchange/new-compliancesearchaction?view=exchange-ps#examples
I would advice you to take a look at New-ComplianceSearch -ContentMatchQuery and include the KQL query "hasattachments:true":
https://docs.microsoft.com/en-us/powershell/module/exchange/new-compliancesearch?view=exchange-ps
After that you can export the results to a PST file.
Take a look at example 4:
https://docs.microsoft.com/en-us/powershell/module/exchange/new-compliancesearchaction?view=exchange-ps#examples